Thursday, June 5, 2014

Re: display data 3 tables

Isn’t $tutor[‘Teacher’][‘User’][‘username’] what you’re looking for?


On 5 Jun 2014, at 14:18, ajt <jagguy999@gmail.com> wrote:

There just is no user being displayed with the below, there is with Teacher in the find if I add it but every field is undefined in the view. 

$this->Tutorsession->recursive = 2;

$contain = array('Teacher' => array('User'));
$this->set('tutor', $this->Tutorsession->find('first',array(
'conditions' => array('Teacher.user_id' => $id),
'contain' => $contain
)));





array( 'Tutorsession' => array( 'id' => '1', 'teacher_id' => '1', 'student_id' => '1', 'subject' => 'maths', 'sessiondate' => '2014-05-06', 'sessiontime' => '2014-05-29 00:27:00', 'available' => '1' ), 'Teacher' => array( 'id' => '1', 'user_id' => '3', 'firstname' => 'fred', 'surname' => 'smith3', 'address' => '1 hard str', 'suburb' => 'chelsea2', 'phone' => '044444444', 'fullname' => 'fred smith3', 'User' => array( 'password' => '*****', 'id' => '3', 'username' => 'teach', 'role' => 'teacher', 'created' => '2014-05-31 11:08:39', 'modified' => '2014-05-31 11:08:39' ), 'Tutorsession' => array( (int) 0 => array( 'id' => '1', 'teacher_id' => '1', 'student_id' => '1', 'subject' => 'maths', 'sessiondate' => '2014-05-06', 'sessiontime' => '2014-05-29 00:27:00', 'available' => '1' ) ) ), 'Student' => array( 'id' => '1', 'user_id' => '1', 'firstname' => 'tom', 'surname' => 'blog', 'address' => '3 glen str ', 'suburb' => 'chelsea', 'phone' => '0444444', 'fullname' => 'tom blog', 'User' => array( 'password' => '*****', 'id' => '1', 'username' => 'admin', 'role' => 'admin', 'created' => '2014-05-30 03:19:36', 'modified' => '2014-05-30 03:19:36' ), 'Tutorsession' => array( (int) 0 => array( 'id' => '1', 'teacher_id' => '1', 'student_id' => '1', 'subject' => 'maths', 'sessiondate' => '2014-05-06', 'sessiontime' => '2014-05-29 00:27:00', 'available' => '1' ) ) ) )

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: