I am new to cake so please be patient. I have this array
Array
(
[0] => Array
(
[CoursesLessons] => Array
(
[id] => 108
[course_id] => 88
[lesson_id] => 6
[deleted] =>
)
[UserLessonsCompleted] => Array
(
[0] => Array
(
[id] => 2
[courses_lessons_id] => 108
[user_id] => 75
[created] => 2015-01-27 14:04:31
[modified] => 0000-00-00 00:00:00
[completed_at] => 2015-02-03 14:04:45
[homework_downloaded_at] => 0000-00-00 00:00:00
[deleted] =>
)
)
)
//and so on
I would like to exctract the UserLessonsCompleted completed at.
What I am trying to do is:
$stringOfIdsCompleted = Set::extract($coursesLessons, '{n}.UserLessonsCompleted.{n}.completed_at');
my problem is that they array that is returned is:
Array
(
[0] => Array
(
[0] => 2015-02-03 14:04:45
)
[1] => Array
(
[0] => 2015-02-06 15:08:01
)
//and so on
while I would like something as:
Array
(
[0] => Array
(
[completed_at] => 2015-02-03 14:04:45
)
[1] => Array
(
[completed_at] => 2015-02-06 15:08:01
)
Any help on how to achieve this? thank you in advance for help
here is how i retrieve my data:
$coursesLessons = $this->CoursesLessons->find('all', array(
'conditions' => array(
'CoursesLessons.course_id' => $courseId,
),
'contain' => array(
'UserLessonsCompleted' => array(
'conditions' => array(
'UserLessonsCompleted.user_id' => $userId,
),
),
)
));