简体   繁体   中英

Lithium PHP framework - query parameters not passed to model ?

I work on a project, built with Lithium PHP framework and some other libraries like the "Resource" library. And so - I have a controller, that starts with:

<?php

namespace app\controllers\admin;

class Prices extends Base {

  protected $_parameters = array(
    'index' => array(

      'prices' => array(
        'required' => false,
        'call'     => array(
          'all',
          'conditions' => array(
            'advertiser' => 'query:advertiser'
          )
        )
      )

    )
  );

And the problem is that when I open the url with $_GET parameter advertiser - it is not passed to the model.

BUT - if I hardcode the advertiser ID like this:

  ...
  'prices' => array(
    'required' => false,
    'call'     => array(
      'all',
      'conditions' => array(
        'advertiser' => '123'
      )
    )
  )

and then I get the prices only for this advertiser - as I should.

What could be wrong? ...

您需要设置过滤器来实现这一点,而且natebele承诺它将重构li3_resources库以使其更加灵活:这是过滤器的链接: https ://gist.github.com/nateabele/5667381它还包括简单的用例代码注释(如果需要)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM