Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

corrected issue with restoring an empty ComposeOne relationship

  • Loading branch information...
commit 62b0f5b1d95145c21baf32787c11e5b9a18b9a3a 1 parent 3307bbf
Jonthan Moss authored
Showing with 6 additions and 4 deletions.
  1. +3 −3 src/morph/Collection.php
  2. +3 −1 src/morph/property/ComposeOne.php
View
6 src/morph/Collection.php
@@ -30,7 +30,7 @@ class Collection extends \ArrayObject
* The classname of the class this collection should allow
* @var String
*/
- private $permissableType = 'Morph\\Object';
+ private $permissableType = '\morph\Object';
/**
* Sets the classname of the class this collection should allow
@@ -215,7 +215,7 @@ public function offsetSet($offset, $object)
*/
private function checkType($object){
if(!($object instanceof $this->permissableType)){
- throw new \RuntimeException('object of type' . \get_class($object) . ' does not extend ' . $this->permissableType);
+ throw new \RuntimeException('object of type ' . \get_class($object) . ' does not extend ' . $this->permissableType);
}
}
@@ -223,6 +223,6 @@ public function __toString()
{
$class = $this->permissableType;
$count = $this->count();
- return "\\Morph\\Collection($class) Count: $count";
+ return "\morph\Collection($class) Count: $count";
}
}
View
4 src/morph/property/ComposeOne.php
@@ -62,7 +62,9 @@ public function setValue($value){
public function __setRawValue($value)
{
$this->value = new $this->type;
- $this->value->__setData($value, \morph\Enum::STATE_CLEAN);
+ if (null !== $value) {
+ $this->value->__setData($value, \morph\Enum::STATE_CLEAN);
+ }
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.