X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FMapper%2FProperty%2FAll.php;h=6eb49457645c246efb91c41d63b4a2e170e52b46;hb=a9b40ffbef4f2280ad0233dbde1d99d057bcc1fa;hp=49fb0a622b4310a9ed410ee316362b62aeb6658c;hpb=d48c6b596a9e62cf275580e1857a90848602fe66;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Mapper/Property/All.php b/lib/pq/Mapper/Property/All.php index 49fb0a6..6eb4945 100644 --- a/lib/pq/Mapper/Property/All.php +++ b/lib/pq/Mapper/Property/All.php @@ -46,15 +46,16 @@ class All implements RefPropertyInterface function write($object, Row $rowToUpdate) { $property = $this->findRefProperty($object); $map = $this->mapper->mapOf($this->refClass); - $refs = $this->extract($object); - foreach ($refs as $ref) { - $property->assign($ref, $object); - } - return function() use($map, $refs) { + if (($refs = $this->extract($object))) { foreach ($refs as $ref) { - $map->unmap($ref); + $property->assign($ref, $object); } - }; + return function() use($map, $refs) { + foreach ($refs as $ref) { + $map->unmap($ref); + } + }; + } } /**