#1409: Doctrine_Collection->remove() 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       |  
---------------------+------------------------------------------------------
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 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?

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1409#comment:1>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to