#1409: Doctrine_Record->unlink() shouldn't implicit delete records
---------------------+------------------------------------------------------
Reporter: sigma | Owner: romanb
Type: task | Status: new
Priority: minor | Milestone: Unknown
Component: Record | Version:
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
---------------------+------------------------------------------------------
Changes (by sigma):
* summary: Doctrine_Collection->remove() shouldn't implicit delete
records => Doctrine_Record->unlink() shouldn't
implicit delete records
Old description:
> IMHO a record removed by Doctrine_Collection should not delete the record
> in the database implicitly. It should just change the collection, and
> should delete the corresponding records not until
> Doctrine_Collection->save() has been called.
>
> The way it is now:
> {{{
> $record->{$referenceName}->remove( $index );
> // the related record has been deleted
> }}}
>
> The way it should be in my opinion:
> {{{
> $record->{$referenceName}->remove( $index );
> // collection has been changed
>
> $record->save();
> // the corresponding record has been deleted
> }}}
>
> Unlinking records works in the same style, first changing the record,
> then saving.
>
> unlinking a record:
> {{{
> $record->unlink( $referenceName, 3 );
> $record->save();
> // not until save() was called, the relation
> // has been unlinked in the database, too
> }}}
>
> What do you think about this?
New description:
IMHO a related record unlinked by Doctrine_Record should not delete the
relation in the database implicitly. It should just change the collection,
and should delete the corresponding related record not until
Doctrine_Record->save() has been called.
Unlinking related records
{{{
$record->unlink( $referenceName, 3 );
// record representing the relation was deleted from the database
}}}
The way it would be clearer in my opinion:
{{{
$record->unlink( $referenceName, 3 );
// record representing the relation wasn't deleted from the database
$record->save();
// the corresponding related record won't be deleted
// not until save() has been called
}}}
Removing the record works in the same way:
{{{
$record->{$referenceName}->remove( $index );
// collection has been changed
$record->save();
// the corresponding record has been deleted
}}}
The changes affected by calling unlink() should affect the database not
until $record->save() has been called.
What do you think about this?
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1409#comment:2>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---