Guest User

Untitled

a guest
May 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Why i am not getting Template model data
  2.  
  3. <?php
  4. class Form extends AppModel {
  5. public $name = 'Form';
  6. public $hasOne = array(
  7. 'Template' => array(
  8. 'className' => 'Template',
  9. 'foreignKey' => 'template_id'
  10. )
  11. );
  12. }
  13.  
  14. .................................................
  15. User , Form, Template
  16.  
  17. User has form_id (form primary key)
  18. form has template_id (template primary key)
  19.  
  20. $this->User->recursive = 0;
  21. $this->User->bindModel(['belongsTo' => ['Form' =>['className' => 'Form', 'foreignKey' => 'form_id']]]);
  22.  
  23. $data = $this->User->find('all', 'contain' => array('Form'));
Add Comment
Please, Sign In to add comment