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

orm: Fix setup of InstrumentedList magic properties

Conflicts:
	include/class.orm.php
parent b104f87e
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,11 @@ class VerySimpleModel { ...@@ -52,6 +52,11 @@ class VerySimpleModel {
// Update of foreign-key by assignment to model instance // Update of foreign-key by assignment to model instance
if (isset(static::$meta['joins'][$field])) { if (isset(static::$meta['joins'][$field])) {
$j = static::$meta['joins'][$field]; $j = static::$meta['joins'][$field];
if ($j['list'] && ($value instanceof InstrumentedList)) {
// Magic list property
$this->ht[$field] = $value;
return;
}
// XXX: Ensure $value instanceof $j['fkey'][0] // XXX: Ensure $value instanceof $j['fkey'][0]
if ($value->__new__) if ($value->__new__)
$value->save(); $value->save();
...@@ -86,11 +91,12 @@ class VerySimpleModel { ...@@ -86,11 +91,12 @@ class VerySimpleModel {
// Construct related lists // Construct related lists
if (isset(static::$meta['joins'])) { if (isset(static::$meta['joins'])) {
foreach (static::$meta['joins'] as $name => $j) { foreach (static::$meta['joins'] as $name => $j) {
if (isset($j['list']) && $j['list']) { if (isset($this->ht[$j['local']])
&& isset($j['list']) && $j['list']) {
$fkey = $j['fkey']; $fkey = $j['fkey'];
$this->{$name} = new InstrumentedList( $this->set($name, new InstrumentedList(
// Send Model, Foriegn-Field, Local-Id // Send Model, Foriegn-Field, Local-Id
array($fkey[0], $fkey[1], $this->{$j['local']}) array($fkey[0], $fkey[1], $this->get($j['local'])))
); );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment