From a795996efadd38c830387ee524cbb1df4068c0b1 Mon Sep 17 00:00:00 2001 From: subzero2000 Date: Mon, 25 Jun 2007 17:51:37 +0000 Subject: [PATCH] Addresses issue of infinte function recursion when saving related objects. Fixes #363. --- lib/Doctrine/Connection/UnitOfWork.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Connection/UnitOfWork.php b/lib/Doctrine/Connection/UnitOfWork.php index b348943b1..bab89e0ec 100644 --- a/lib/Doctrine/Connection/UnitOfWork.php +++ b/lib/Doctrine/Connection/UnitOfWork.php @@ -221,11 +221,15 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module } else { // ONE-TO-ONE relationship $obj = $record->get($rel->getAlias()); - $obj->save($this->conn); - } + // Protection against infinite function recursion before attempting to save + if ($obj->isModified()) { + $obj->save($this->conn); + } + } } } + return $saveLater; } /**