cakephp 错误:意外的'(',期待')',我的语法错误吗?
您在这里看到任何语法错误吗?
'Coupon'=>array(
'fields'=>array(
'promo_code','desc'
),
'conditions'=>array(
'OR'=>array(
'expires' =>0,
'Coupon.end_date >'=>date('Y-m-d')
)
)
),
这是我的控制器代码中“包含”数组的一部分。当我从代码中删除此代码片段时,蛋糕效果很好(只有我需要这部分!)。我将完整声明发布在下面。帮助?
public $paginate = array(
'Location'=>array(
'joins' => array(
array(
'table' => 'locations_tags',
'alias' => 'LocationsTag',
'type' => 'inner',
'conditions'=> array(
'LocationsTag.location_id = Location.id'
)
)
),
'limit'=>9,
'contain'=>array(
'Course'=>array(
'fields'=>array(
'specials', 'contact','desc'
),
'conditions'=>array('Course.active'=>1)
),
'Charter'=>array(
'fields'=>array(
'book','specials', 'contact','desc'
),
'conditions'=>array('Charter.active'=>1)
),
'Restaurant'=>array(
'fields'=>array(
'menu','wine_list','specials', 'contact','desc'
),
'conditions'=>array('Restaurant.active'=>1)
),
'Nightclub'=>array(
'fields'=>array(
'menu','schedule','specials', 'contact','desc'
),
'conditions'=>array('Nightclub.active'=>1)
),
'Store'=>array(
'fields'=>array(
'catalog','specials', 'contact','desc'
),
'conditions'=>array('Store.active'=>1)
),
'Coupon'=>array(
'fields'=>array(
'promo_code','desc'
),
'conditions'=>array(
'OR'=>array(
'expires' =>0,
'Coupon.end_date >'=>date('Y-m-d')
)
)
),
'Image',
'Tag'=>array(
'fields'=>array(
'seo_tag'
)
)
)
)
);
Do you see any syntax errors here?
'Coupon'=>array(
'fields'=>array(
'promo_code','desc'
),
'conditions'=>array(
'OR'=>array(
'expires' =>0,
'Coupon.end_date >'=>date('Y-m-d')
)
)
),
This is part of my 'contain' array in my controller code. When I remove this snippet from my code, cake works great (only I need this part!). Am posting the entire statement below. Help?
public $paginate = array(
'Location'=>array(
'joins' => array(
array(
'table' => 'locations_tags',
'alias' => 'LocationsTag',
'type' => 'inner',
'conditions'=> array(
'LocationsTag.location_id = Location.id'
)
)
),
'limit'=>9,
'contain'=>array(
'Course'=>array(
'fields'=>array(
'specials', 'contact','desc'
),
'conditions'=>array('Course.active'=>1)
),
'Charter'=>array(
'fields'=>array(
'book','specials', 'contact','desc'
),
'conditions'=>array('Charter.active'=>1)
),
'Restaurant'=>array(
'fields'=>array(
'menu','wine_list','specials', 'contact','desc'
),
'conditions'=>array('Restaurant.active'=>1)
),
'Nightclub'=>array(
'fields'=>array(
'menu','schedule','specials', 'contact','desc'
),
'conditions'=>array('Nightclub.active'=>1)
),
'Store'=>array(
'fields'=>array(
'catalog','specials', 'contact','desc'
),
'conditions'=>array('Store.active'=>1)
),
'Coupon'=>array(
'fields'=>array(
'promo_code','desc'
),
'conditions'=>array(
'OR'=>array(
'expires' =>0,
'Coupon.end_date >'=>date('Y-m-d')
)
)
),
'Image',
'Tag'=>array(
'fields'=>array(
'seo_tag'
)
)
)
)
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能在类属性声明中分配计算值(例如,调用函数)。它们必须是恒定值。
对于计算值,您必须在构造函数或其他东西中分配它。
来自文档:
You can't assign calculated values (e.g., calling functions) in class property declarations. They have to be constant values.
For a calculated value, you'd have to assign that in the constructor or something.
From the docs: