has many - Issue with belongsTo and hasMany in CakePHP -


i'm facing issue models. have controller 'jobapplications' linked 'history' model :

public $hasmany = array(     'history' => array(         'order' => array('history.created' => 'desc')     ) ); 

'history' model contains multiple lines.

my history model has 'belongsto' line :

public $belongsto = array('status', 'user'); 

problem link 'status' , 'user' not made, don't have fields these tables.

do have idea ?

edit : manage using 'recursive' => 3 in controller, i'm getting fiels, it's not clean.

i try add :

    'contain' => array(         'history' => array(             'status' => array('fields' => array('status.name')),             'user'=> array('fields' => array('user.username')),         ),         'diploma', 'field', 'area'     ), 

and :

public $actsas = array('containable'); 

to other models, doesn't work.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -