mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
d06dd6c713
commit
8f4eda68fc
2 changed files with 5 additions and 6 deletions
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue