This commit is contained in:
parent
1a4baae1df
commit
5b22e5431f
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user