Add deterministic ordering to translate associations.

Having a deterministic ordering based on the primary key resolves
tests potentially failing when postgres returns data in a non-sequential
order.
This commit is contained in:
mark_story 2014-10-24 22:21:06 -04:00
parent b5050db643
commit 4b5783c5fe

View file

@ -590,7 +590,8 @@ class TranslateBehavior extends ModelBehavior {
$RuntimeModel = $this->translateModel($Model);
$default = array(
'className' => $RuntimeModel->alias,
'foreignKey' => 'foreign_key'
'foreignKey' => 'foreign_key',
'order' => 'id'
);
foreach ($fields as $key => $value) {