From 030617713db83a789df07d1a339568d7dbfdc4e7 Mon Sep 17 00:00:00 2001 From: abijah Date: Wed, 22 Jul 2009 22:54:02 +0000 Subject: [PATCH] Attempted fix for a missing conditions/fields bug. The fix would probably have just been to use empty instead of isset, since apparently the defaults for these items are an empty string instead of null (yuck). However, I already had done a bit of minor logic change and prefer the new form, so that's why more than just the isset call was modified. git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@363 97e9348a-65ac-dc4b-aefc-98561f571b83 --- models/behaviors/linkable.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/models/behaviors/linkable.php b/models/behaviors/linkable.php index e3b9d3f..4f71156 100644 --- a/models/behaviors/linkable.php +++ b/models/behaviors/linkable.php @@ -259,8 +259,12 @@ 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 (isset($options[$fld]) && is_array($options[$fld]) && - isset($association[$fld]) && is_array($association[$fld])) + if (!empty($options[$fld]) && !is_array($options[$fld])) + $options[$fld] = array($options[$fld]); + if (!empty($association[$fld]) && !is_array($association[$fld])) + $association[$fld] = array($association[$fld]); + + if (!empty($options[$fld]) && !empty($association[$fld])) $options[$fld] = array_merge($options[$fld], $association[$fld]); }