Ticket #632 (closed enhancement: fixed)
change behavior of "unset" from "delete" to "unlink"
| Reported by: | chris | Owned by: | somebody |
|---|---|---|---|
| Priority: | critical | Milestone: | 1.0.3 |
| Component: | Other | Version: | 1.0.2 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | no | |
| Status: | Pending Core Response | Has Patch: | no |
Description
$book = new Book(); $book->title = "Jungle Expedition Handbook"; $archimedes2 = new Author(); $archimedes2->name = 'Archimedes Q. Porter 2'; $archimedes2->books[] = $book; $archimedes2->save(); unset($archimedes2->books[0]); $archimedes2->save();
The unset function deletes the book row and the association table entry. I think it would be much more intuitive if it would ONLY remove the association table row, but not the book row. Object can still be explicitly deleted using the delete method. Until now the unlink method is used to only delete the association, but it can only be used if an object has an id, thus not if an object was not yet saved to the database.
Change History
Note: See
TracTickets for help on using
tickets.