Hi
I have a problem with find query:
$userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id)));
The result array:
Array
(
[0] => Array
(
[UserInProject] => Array
(
[id] => 11
[project_id] => 3
[position_id] => 1
[user_id] => 15
)
[Project] => Array
(
[id] => 3
[short_name] => proj1
[full_name] => project 1
[start_date] => 2010-01-01
[end_date] => 2010-05-01
[agreement_number] => 12/34U/23
[active] => 1
[user_id] => 1
)
[Position] => Array
(
[id] => 1
[name] => some_name
)
[User] => Array
(
[id] => 15
[username] => foo
[first_name] =>
[last_name] =>
[email] =>
[email protected]
[active] => 1
[created] =>
[modified] =>
)
[RegularPost] => Array
(
[0] => Array
(
[id] => 792
[date] => 2010-01-01
[size] => 0.20000
[users_in_project_id] => 11
)
[1] => Array
(
[id] => 793
[date] => 2010-02-01
[size] => 0.20000
[users_in_project_id] => 11
)
( and many more ...)
)
)
[1] => Array
(
[UserInProject] => Array
(
[id] => 20
[project_id] => 3
[position_id] =>
2
[user_id] => 15
)
[Project] => Array
(
[id] => 3
[short_name] => proj1
[full_name] => project 1
[start_date] => 2010-01-01
[end_date] => 2010-05-01
[agreement_number] => 12/34U/23
[active] => 1
[user_id] => 1
)
[Position] => Array
(
[id] =>
2
[name] => some_name2
)
[User] => Array
(
[id] => 15
[username] => foo
[first_name] =>
[last_name] =>
[email] =>
[email protected]
[active] => 1
[created] =>
[modified] =>
)
[RegularPost] => Array
(
[0] => Array
(
[id] => 836
[date] => 2010-01-01
[size] => 0.
2
[users_in_project_id] => 20
)
[1] => Array
(
[id] => 837
[date] => 2010-02-01
[size] => 0.3
[users_in_project_id] => 20
)
[2] => Array
(
[id] => 838
[date] => 2010-03-01
[size] => 0.3
[users_in_project_id] => 20
)
( and many more ...)
)
)
)
What I want to achive is the array like above but RegularPost with [date] = 2010-02-01 only.
Is there any way to pass the date '2010-02-01' to the RegularPost in this query?
This query doesn't work:
$userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id, 'RegularPost.date' => '2010-02-01')));
1054: Unknown column 'RegularPost.date' in 'where clause'
Please help. :)