[英]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. 我正在研究一个使用Lithium PHP框架和“ Resource”库之类的其他库构建的项目。 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. 问题是当我使用$ _GET参数
advertiser
打开url时,它没有传递给模型。
BUT - if I hardcode the advertiser ID like this: 但是-如果我这样对广告客户ID进行硬编码:
...
'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它还包括简单的用例代码注释(如果需要)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.