Commit 11baf619 by Qiang Xue

Fixed unsetting relation bug.

parent 4d538d6b
......@@ -251,7 +251,7 @@ class Component extends Object
}
}
}
throw new InvalidCallException('Unsetting an unknown or read-only property: ' . get_class($this) . '.' . $name);
throw new InvalidCallException('Unsetting an unknown or read-only property: ' . get_class($this) . '::' . $name);
}
/**
......
......@@ -303,14 +303,12 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
{
if ($this->hasAttribute($name)) {
unset($this->_attributes[$name]);
} else {
if (isset($this->_related[$name])) {
} elseif (array_key_exists($name, $this->_related)) {
unset($this->_related[$name]);
} else {
parent::__unset($name);
}
}
}
/**
* Declares a `has-one` relation.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment