cgridview - YII "Property x is not defined" ... except it is -


solution:

there samples.php file in document root of application. how functioned in normal yii execution chain of app beyond me. did, , deleted , stuff works normal. thanks!


update: app-level caching issue, except caching (that know of) disabled. can go produciton models folder , delete various models, , immediatley yii throws expected error these models don't exist. not samples model. stays around.


i'm having strange problem yii search.

what i'm doing searching on related model i've done 100 times before. works fine on development host publish production host, fails with: property "samples.cancer_search" not defined.

i've double , triple checked files being published. property listed in "safe on search" list within rules in samples model. property declared public var in model. works in dev, when publish these files (and whole app) production, still gives property not defined.

even stranger this, went prod server , copied bad model, controller, , view use new name (uses same db table) , works fine. did change name of model, controller , view samples samplestest/samplestestcontroller, , works!

i've disabled caching (was using memcache) , restarted server. still gives same error.

the model (works on dev, not on prod. shortened clarity)

 class samples extends cactiverecord  {  // .... //   // search/sort on related data public $cancer_search; public $cancer_search_test;  // .... //   public function rules() {     return array(         array('id, patient_id, cancer, cancer_id, cancer_search, cancer_search_test, requested_date, ...', 'safe', 'on'=>'search'),     ); }  public function relations() {     // note: may need adjust relation name , related     // class name relations automatically generated below.     return array(         'cancer' => array(self::belongs_to, 'cancers', 'cancer_id'),         'cancertest' => array(self::belongs_to, 'cancers', 'cancer_id'),         ) }  public function attributelabels() {     return array(         'cancer_id' => 'cancer classification',         'cancer' => 'cancer classification',         'cancer_search' => 'cancer classification',         'cancer_search_test' => 'cancer classification',     ); }  public function search() {       $criteria=new cdbcriteria;             $criteria->group = 't.id';       $criteria->together = true;      $criteria->with[] = 'cancer';     if($this->cancer_search) {       $criteria->addsearchcondition("cancer.name",$this->cancer_search);     }      $criteria->compare('id',$this->id,true);     $criteria->compare('patient_id',$this->patient_id,true);      return new cactivedataprovider($this, array(         'criteria'=>$criteria,         'sort'=>array(             'attributes'=>array(                                     'cancer_search'=>array(                     'asc'=>'cancer.name',                     'desc'=>'cancer.name desc',                 ),                 '*',             ),         ),      ));  } 

and search view

 // on production, doesn't throw error, search doesn't work  $columns[]= array(         'name'  => 'cancer',         'value'=>'$data->cancer->name',          'type'  => 'raw',         'htmloptions'=>array('style'=>'width:100px;'),     );   // gives property not defined error on prod, though defined, , works fine on dev  $columns[]= array(         'name'  => 'cancer_search',         'value'=>'$data->cancer->name',          'type'  => 'raw',         'htmloptions'=>array('style'=>'width:100px;'),     );    // both of these work fine on dev. 

i've cleared yii assets folder no avail.

am going insane or possibly caching i'm not aware of?

thanks.

--

one additional clue- noticed in search grid on prod server it's not using correct attribute label in column header either. not sure why cause it's same on dev , prod.


edit 2 tried declaring public var in model , tracing log in controller search method, , same deal. var exists on dev, not on prod.

edit 3 know being cached. deleted samples model , continues use old cached version doesn't find new properties. memcached disabled, , reset mysql query cache. still using phantom model.

it turned out there old samples.php model file in document root of application. must have accidentally uploaded there.

surprisingly, rather causing yii app fail, worked override samples.php model (or wasn't) in models/

i expected app load components under protected apparently not.

thanks.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -