php - CakePHP error "Model is not associated with model..." -


i having trouble cakephp

the agent model: agent.php

class agent extends appmodel{     var $name = 'agent';      var $belongsto = array(     'arrival'=>array(         'classname'=>'airtime',         'foreignkey'=>'arrival_id'     ),     'departure'=>array(         'classname'=>'airtime',         'foreignkey'=>'departure_id'     )); } 

the airtime model: airtime.php

class airtime extends appmodel{     var $name = 'airtime'; } 

controller: agentcontroller.php

        $condition = array(             'limit'=>20,             'contain'=>array(                 'arrival'=>array(                     'fields'=>array('airline_id','flight_num'),                     'airline'=>array('fields'=>'code')                 ),                 'departure'=>array(                     'fields'=>array('airline_id','flight_num'),                     'airline'=>array('fields'=>'code')                 )             )         );          $this->agent = classregistry::init('agent');         $this->paginate=$condition;         $data = $this->paginate('agent'); 

when run following errors:

warning (512): model "agent" not associated model "arrival" [core/cake/libs/model/behaviors/containable.php, line 343] warning (512): model "agent" not associated model "departure" [core/cake/libs/model/behaviors/containable.php, line 343] 

i not know how solve problem , help.

rename files

agent.php -> agent.php airtime.php -> airtime.php agentcontroller.php -> agentcontroller.php 

source: http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html#file-and-class-name-conventions


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -