Yet another tweak to Linkable for merging fields and conditions of the options and associations variables.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@369 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -259,14 +259,14 @@ class LinkableBehavior extends ModelBehavior {
|
|||||||
// in either/or, but a couple should include BOTH the
|
// in either/or, but a couple should include BOTH the
|
||||||
// options AND the association settings.
|
// options AND the association settings.
|
||||||
foreach (array('fields', 'conditions') AS $fld) {
|
foreach (array('fields', 'conditions') AS $fld) {
|
||||||
if (empty($options[$fld]))
|
if (isset($options[$fld]) && empty($options[$fld]) && !is_array($options[$fld]))
|
||||||
$options[$fld] = array();
|
unset($options[$fld]);
|
||||||
elseif (!is_array($options[$fld]))
|
elseif (!empty($options[$fld]) && !is_array($options[$fld]))
|
||||||
$options[$fld] = array($options[$fld]);
|
$options[$fld] = array($options[$fld]);
|
||||||
|
|
||||||
if (empty($association[$fld]))
|
if (isset($association[$fld]) && empty($association[$fld]) && !is_array($association[$fld]))
|
||||||
unset($association[$fld]);
|
unset($association[$fld]);
|
||||||
elseif (!is_array($association[$fld]))
|
elseif (!empty($association[$fld]) && !is_array($association[$fld]))
|
||||||
$association[$fld] = array($association[$fld]);
|
$association[$fld] = array($association[$fld]);
|
||||||
|
|
||||||
if (isset($options[$fld]) && isset($association[$fld]))
|
if (isset($options[$fld]) && isset($association[$fld]))
|
||||||
|
|||||||
Reference in New Issue
Block a user