Fixed issues with Controller::persistModel and behaviors, closes #4647

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6959 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-05-19 08:03:00 +00:00
parent d06dd6c713
commit 8f4eda68fc
2 changed files with 5 additions and 6 deletions

View file

@ -438,7 +438,7 @@ class Controller extends Object {
}
if ($this->persistModel === true) {
$this->_persist($modelClass, true, $model);
$this->_persist($modelClass, true, $this->{$modelClass});
$registry = ClassRegistry::getInstance();
$this->_persist($modelClass . 'registry', true, $registry->__objects, 'registry');
}

View file

@ -263,15 +263,14 @@ class Object {
case 'registry':
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
if(strpos($key, '_behavior')) {
App::import('Behavior', Inflector::classify(str_replace('_behavior', '', $key)));
} else {
App::import('Model', Inflector::classify($key));
}
App::import('Model', Inflector::classify($key));
}
unset($vars);
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
foreach ($vars['0'][$key]->Behaviors->_attached as $behavior) {
App::import('Behavior', $behavior);
}
ClassRegistry::addObject($key, $value);
unset ($value);
}