X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FMapper%2FProperty%2FRef.php;h=8d9fce67bf6c0bec72f8f2b309f2034e75ba95aa;hb=861bb294d28aba35e011d9d35aad750d93c7dbd7;hp=01489d9c1b8180e201c37759dfd99b5981880a93;hpb=05a907a5cb7377e2ad7abfa21096e3630752b944;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Mapper/Property/Ref.php b/lib/pq/Mapper/Property/Ref.php index 01489d9..8d9fce6 100644 --- a/lib/pq/Mapper/Property/Ref.php +++ b/lib/pq/Mapper/Property/Ref.php @@ -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",