2012-02-09 5 views
0

ここに構文エラーがありますか?cakephpエラー:予期しない '('、expecting ')'、私の構文が間違っていますか?

'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

答えて

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

ありがとうございます。今、その部分を理解するために今..... – huzzah

関連する問題