From 8db607ffc518233c747f3a4e8a04684cd4e250d0 Mon Sep 17 00:00:00 2001 From: abijah Date: Wed, 22 Jul 2009 23:12:04 +0000 Subject: [PATCH] Of course, the last fix didn't work... I don't know why it looked like it was working. This fix should resolve the issue. git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@364 97e9348a-65ac-dc4b-aefc-98561f571b83 --- models/behaviors/linkable.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/models/behaviors/linkable.php b/models/behaviors/linkable.php index 4f71156..cb0622b 100644 --- a/models/behaviors/linkable.php +++ b/models/behaviors/linkable.php @@ -259,12 +259,17 @@ class LinkableBehavior extends ModelBehavior { // in either/or, but a couple should include BOTH the // options AND the association settings. foreach (array('fields', 'conditions') AS $fld) { - if (!empty($options[$fld]) && !is_array($options[$fld])) + if (empty($options[$fld])) + $options[$fld] = array(); + elseif (!is_array($options[$fld])) $options[$fld] = array($options[$fld]); - if (!empty($association[$fld]) && !is_array($association[$fld])) + + if (empty($association[$fld])) + unset($association[$fld]); + elseif (!is_array($association[$fld])) $association[$fld] = array($association[$fld]); - if (!empty($options[$fld]) && !empty($association[$fld])) + if (isset($options[$fld]) && isset($association[$fld])) $options[$fld] = array_merge($options[$fld], $association[$fld]); }