Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Why i am not getting Template model data
- <?php
- class Form extends AppModel {
- public $name = 'Form';
- public $hasOne = array(
- 'Template' => array(
- 'className' => 'Template',
- 'foreignKey' => 'template_id'
- )
- );
- }
- .................................................
- User , Form, Template
- User has form_id (form primary key)
- form has template_id (template primary key)
- $this->User->recursive = 0;
- $this->User->bindModel(['belongsTo' => ['Form' =>['className' => 'Form', 'foreignKey' => 'form_id']]]);
- $data = $this->User->find('all', 'contain' => array('Form'));
Add Comment
Please, Sign In to add comment