1
0
mirror of synced 2025-01-18 22:41:43 +03:00
This commit is contained in:
zYne 2007-05-21 16:02:30 +00:00
parent 1a4baae1df
commit 5b22e5431f

View File

@ -33,44 +33,6 @@ Doctrine::autoload('Doctrine_Relation');
*/
class Doctrine_Relation_ForeignKey extends Doctrine_Relation
{
/**
* processDiff
*
* @param Doctrine_Record $record
* @param Doctrine_Connection $conn
* @return void
*/
public function processDiff(Doctrine_Record $record, $conn = null)
{
if (!$conn) {
$conn = $this->getTable()->getConnection();
}
$alias = $this->getAlias();
if ($this->isOneToOne()) {
if ($record->obtainOriginals($alias)
&& $record->obtainOriginals($alias)->obtainIdentifier() != $this->obtainReference($alias)->obtainIdentifier()
) {
$record->obtainOriginals($alias)->delete($conn);
}
} else {
if ($record->hasReference($alias)) {
$new = $record->obtainReference($alias);
if ( ! $record->obtainOriginals($alias)) {
$record->loadReference($alias);
}
$operations = Doctrine_Relation::getDeleteOperations($record->obtainOriginals($alias), $new);
foreach ($operations as $r) {
$r->delete($conn);
}
$record->assignOriginals($alias, clone $record->get($alias));
}
}
}
/**
* fetchRelatedFor
*