Hi there,
I have some many to many relations. e.g. Person has Jobs and the Jobs which are assigned to a person.
Now I want to check if a Person already has a job I assign it and run in a constraint error....
Is there a better way than this?:
$personJob = PersonJob::findFirst(array(
"conditions" => "personID = ?1 AND jobID = ?2",
"bind" => array(1 => $personID, 2 => $jobID)
));
if($personJob == true)
{
//person has already the job
}else{
//jobless => assign the job
}