2012-02-09 92 views
0

你在这里看到任何语法错误吗?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' 
      ) 
      ) 
     ) 
    ) 
); 
+0

哪行引发错误? – Blender 2012-02-09 17:19:48

回答

2
 'Coupon.end_date >'=>date('Y-m-d') 

不能分配在类属性声明计算值(例如,调用函数)。他们必须是不变的价值观。

对于计算的值,您必须在构造函数中指定它或其他值。

the docs

This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.

+0

谢谢。 oohhhhhhhhay,现在要弄清楚那一部分..... – huzzah 2012-02-09 17:36:44

相关问题