/**
  * Updates object with provided values, dealing with eventual relation deletion
  *
  * @see sfFormDoctrine::doUpdateObject()
  */
 protected function doUpdateObject($values)
 {
     if (count($this->getScheduledForDeletion()) > 0) {
         foreach ($this->getScheduledForDeletion() as $relationName => $ids) {
             $relation = $this->getObject()->getTable()->getRelation($relationName);
             foreach ($ids as $index => $id) {
                 if ($relation->isOneToOne()) {
                     unset($values[$relationName]);
                 } else {
                     unset($values[$relationName][$index]);
                 }
                 if (!$relation->isOneToOne()) {
                     unset($this->object[$relationName][$index]);
                 } else {
                     $this->object->clearRelated($relationName);
                 }
                 Doctrine::getTable($relation->getClass())->findOneById($id)->delete();
             }
         }
     }
     if (count($this->scheduledForInsertion) > 0) {
         $mainObject = $this->getObject();
         foreach ($this->scheduledForInsertion as $containerName => $newFormList) {
             foreach ($newFormList as $insertionSpec) {
                 $relatedObject = $insertionSpec['form']->getObject();
                 $relation = $insertionSpec['relation'];
                 $relationName = $insertionSpec['relationName'];
                 if ($relation->isOneToOne()) {
                     $mainObject->{$relationName} = $relatedObject;
                 } else {
                     $relatedObjectList = $mainObject->{$relationName};
                     $relatedObjectList[] = $relatedObject;
                 }
                 // $relatedObject->setRelated($relation->getForeignColumnName(), $mainObject);
             }
         }
     }
     parent::doUpdateObject($values);
     // set foreign key here
 }
 /**
  * Updates object with provided values, dealing with eventual relation deletion
  *
  * @see sfFormDoctrine::doUpdateObject()
  */
 protected function doUpdateObject($values)
 {
     if (count($this->getScheduledForDeletion()) > 0) {
         foreach ($this->getScheduledForDeletion() as $relationName => $ids) {
             $relation = $this->getObject()->getTable()->getRelation($relationName);
             foreach ($ids as $index => $id) {
                 if ($relation->isOneToOne()) {
                     unset($values[$relationName]);
                 } else {
                     unset($values[$relationName][$index]);
                 }
                 if (!$relation->isOneToOne()) {
                     unset($this->object[$relationName][$index]);
                 } else {
                     $this->object->clearRelated($relationName);
                 }
                 Doctrine::getTable($relation->getClass())->findOneById($id)->delete();
             }
         }
     }
     parent::doUpdateObject($values);
     // set foreign key here
 }