Skip to content
Snippets Groups Projects
Commit 93a34c43 authored by Jared Hancock's avatar Jared Hancock
Browse files

orm: Don't null out value on assignment

This fixes an issue where the PK of ThreadEntry will be NULLed in the
following code

```php
$entry = ThreadEntry::create(array(...));
$entry->save();
$entry->email_info = new ThreadEntryEmailInfo(array(
    'mid' => 'xyzAbc',
));
```

In the above code, the $entry->__set('email_info', <ThreadEntryEmailInfo>)
would be invoked. The ThreadEntryEmailInfo object is new, and so will cause
the local part of the relationship (`id` in this case) to
become null further down in the `__set` method.

This issue is fixed in this commit by removing the NULL assignment to the
new object. This was added in 11322766,
however, it is unclear why the null assignment is performed.
parent 00a1371d
Branches
Tags
No related merge requests found
......@@ -429,11 +429,7 @@ class VerySimpleModel {
}
// Capture the object under the object's field name
$this->ht[$field] = $value;
if ($value->__new__)
// save() will be performed when saving this object
$value = null;
else
$value = $value->get($j['fkey'][1]);
$value = $value->get($j['fkey'][1]);
// Fall through to the standard logic below
}
// Capture the foreign key id value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment