storage test
[m6w6/pq-gateway] / lib / pq / Mapper / Property / All.php
index 6eb49457645c246efb91c41d63b4a2e170e52b46..02855fd279a678c5a76ebe536991a4c76d20f3c7 100644 (file)
@@ -44,13 +44,13 @@ class All implements RefPropertyInterface
         * @return callable deferred callback
         */
        function write($object, Row $rowToUpdate) {
-               $property = $this->findRefProperty($object);
-               $map = $this->mapper->mapOf($this->refClass);
                if (($refs = $this->extract($object))) {
+                       $property = $this->findRefProperty($object);
                        foreach ($refs as $ref) {
                                $property->assign($ref, $object);
                        }
-                       return function() use($map, $refs) {
+                       return function() use($refs) {
+                               $map = $this->mapper->mapOf($this->refClass);
                                foreach ($refs as $ref) {
                                        $map->unmap($ref);
                                }