From 4b5783c5fe993d3be4a5018de0e8aca77228301f Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 24 Oct 2014 22:21:06 -0400 Subject: [PATCH] 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. --- lib/Cake/Model/Behavior/TranslateBehavior.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index 26d86a6dc..c464bf0b2 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -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) {