Handle plugin association consistently

This commit is contained in:
Philippe Saint-Just 2016-07-09 16:08:16 +01:00
parent ae42debeff
commit 7edcdb0799

View file

@ -1035,13 +1035,13 @@ class Model extends Object implements CakeEventListener {
unset($association[$assoc]);
$assoc = $value;
$value = array();
$association[$assoc] = $value;
}
if (strpos($assoc, '.') !== false) {
list($plugin, $assoc) = pluginSplit($assoc, true);
$association[$assoc] = array('className' => $plugin . $assoc);
} else {
$association[$assoc] = $value;
}
if (!isset($value['className']) && strpos($assoc, '.') !== false) {
unset($association[$assoc]);
list($plugin, $assoc) = pluginSplit($assoc, true);
$association[$assoc] = array('className' => $plugin . $assoc) + $value;
}
$this->_generateAssociation($type, $assoc);