Ticket #1280 (closed defect: fixed)
Can't unset one-to-many relation on the "one" side
| Reported by: | pstradomski | Owned by: | romanb |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Relations | Version: | 1.0.0 |
| Severity: | Keywords: | ||
| Cc: | pstradomski@… | Has Test: | no |
| Status: | Pending Core Response | Has Patch: | no |
Description
Group has many Users.
The GroupId? field is nullable
$user->Group = $group; $user->save();
Now none of the below work:
$user->Group = null;
unset($user->Group)
$user->unlink('Group')
The first one fails immediately, the second and third attempt to delete the group instead of setting GroupId? to NULL. It is only possible to use $user->GroupId = null, but this does not remove the relation, so isset($user->Group) still returns true.
Change History
Note: See
TracTickets for help on using
tickets.