For those who have similar problems, but in the a-la $ relationship, Too owns, in order to have the correct order, you have to set it correctly.
For example, if you have a code like this:
var $belongsTo = array( 'Vacancy', 'Applicant' => array( 'className' => 'Person', ), 'Recruiter' => array( 'className' => 'Person', ), 'Company' => array( 'conditions' => array('Company.id = Vacancy.company_id'), ), );
But the result always results in which the vacancy is always connected last, you have to do simple things: add this model “Vacancy” not as an array value, but as a key => value, like others:
var $belongsTo = array( 'Vacancy' => array(), // Just add empty array here -- all magic is here :) 'Applicant' => array( 'className' => 'Person', ), 'Recruiter' => array( 'className' => 'Person', ), 'Company' => array( 'conditions' => array('Company.id = Vacancy.company_id'), ), );
Now everything will be in order: Vacancy, Applicant, Recruiter and only then the Company.
source share