map test
[m6w6/pq-gateway] / lib / pq / Mapper / Property / Ref.php
index 01489d9c1b8180e201c37759dfd99b5981880a93..8d9fce67bf6c0bec72f8f2b309f2034e75ba95aa 100644 (file)
@@ -45,8 +45,10 @@ class Ref implements RefPropertyInterface
         * @throws UnexpectedValueException
         */
        function write($object, Row $rowToUpdate) {
+               if (!$ref = $this->extract($object)) {
+                       return;
+               }
                $map = $this->mapper->mapOf($this->refClass);
-               $ref = $this->extract($object);
                if (!$rel = $map->relOf($this->container, $this->refName)) {
                        throw new UnexpectedValueException(
                                sprintf("Unrelated reference from %s to %s with name %s",