Skip to content
Permalink
Browse files

Fix remaining failing tests in Table class.

* Fix broken return values.
* Fix recursion issues with associated saves.
  • Loading branch information...
markstory committed Dec 19, 2013
1 parent 7a56155 commit 829d358b117aab8f79d5d212a17a3ab5d5b4c8ae
Showing with 7 additions and 4 deletions.
  1. +2 −1 Cake/ORM/Associations.php
  2. +5 −3 Cake/ORM/Table.php
@@ -143,6 +143,7 @@ public function saveChildren(Table $table, Entity $entity, $associations, $optio
* @throws new \InvalidArgumentException When an unknown alias is used.
*/
protected function _saveAssociations($table, $entity, $associations, $options, $owningSide) {
unset($options['associated']);
foreach ($associations as $alias => $nested) {
if (is_int($alias)) {
$alias = $nested;
@@ -179,7 +180,7 @@ protected function _saveAssociations($table, $entity, $associations, $options, $
*/
protected function _save($association, $entity, $nested, $options) {
if (!$entity->dirty($association->property())) {
return;
return true;
}
if (!empty($nested)) {
$options = (array)$nested + $options;
@@ -1094,16 +1094,18 @@ protected function _processSave($entity, $options) {
$event = new Event('Model.afterSave', $this, compact('entity', 'options'));
$this->getEventManager()->dispatch($event);
$entity->isNew(false);
$success = $entity;
$success = true;
}
}
if (!$success && $isNew) {
$entity->unsetProperty($this->primaryKey());
$entity->isNew(true);
}
return $success;
if ($success) {
return $entity;
}
return false;
}
/**

0 comments on commit 829d358

Please sign in to comment.
You can’t perform that action at this time.