private function __deleteAssociationObject(PersistentObject $object, AssociationMap $associationMap, PersistentObject $refObject, &$commands, ClassMap $classMap) { $toAttributeMap = $associationMap->getToAttributeMap(); $fromAttributeMap = $associationMap->getFromAttributeMap(); if ($associationMap->getCardinality() == 'oneToOne' || $associationMap->getCardinality() == 'oneToMany') { // obtem o objeto referenciado if ($refObject != NULL) { // se a associação é inversa, atualiza o objeto referenciado if ($associationMap->isInverse()) { $refObject->setAttributeValue($toAttributeMap, NULL); $this->_saveObject($refObject, $associationMap->getToClassMap(), $commands); } else { // se a associação é direta, atualiza o próprio objeto $object->setAttributeValue($fromAttributeMap, NULL); $this->_saveObject($object, $classMap, $commands); } } } elseif ($associationMap->getCardinality() == 'manyToMany') { // remove os registros da associação com $refObject $commands = array(); if ($object->getOIDValue()) { $commands[] = $associationMap->getDeleteStatement($object, $refObject); } } $this->__retrieveAssociation($object, $associationMap, $classMap); }