0
我有一些非常奇怪的'包含'行为。每当我离开$餐馆评论时,$ spas返回包含的数据(在beforeFilter()中分配),但是当我取消注释$ restaurants时,它忽略了包含语句(我甚至试图克隆$ spas函数并将其命名为“$餐馆”,同样的事情发生了..CakePHP:奇怪的包含行为
class CouponsController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
$this->Coupon->contain(array('Vendor' => array('VendorLocation'), 'Category'));
}
public function index() {
$showPerPage = 4;
//$restaurants = $this->Coupon->findAllBycategory_id('1', '', '', $showPerPage);
$spas = $this->Coupon->find('all', array('limit' => $showPerPage, 'conditions' => array('Coupon.category_id' => 3)));
$this->set('spas', $spas);
}
您是否尝试将注释行更改为常规查找查询,如'$ restaurants = $ this-> Coupon-> find('all',array('conditions'=>'category_id'=> 1,'限制'=> $ showPerPage))'? – 2012-02-28 00:13:56