Moss/Storage/Query/Relation/OneRelation.php
public function write(&$result)
    {
        $entity = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($entity)) {
            $conditions = [];
            foreach ($this->definition->keys() as $local => $foreign) {
                $conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local);
            }

            $this->cleanup($this->definition->entity(), [], $conditions);
            return $result;
        }

        $this->assertInstance($entity);

        foreach ($this->definition->keys() as $local => $foreign) {
            $this->accessor->setPropertyValue($entity, $foreign, $this->accessor->getPropertyValue($result, $local));
        }

        $this->storage->write($entity, $this->definition->entity())->execute();
        $this->accessor->setPropertyValue($result, $this->definition->container(), $entity);

        return $result;
    }
public function write(&$result)
    {
        $entity = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($entity)) {
            $conditions = [];
            foreach ($this->definition->keys() as $local => $foreign) {
                $conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local);
            }

            $this->cleanup($this->definition->entity(), [], $conditions);
            return $result;
        }

        $this->assertInstance($entity);

        foreach ($this->definition->keys() as $local => $foreign) {
            $this->accessor->setPropertyValue($entity, $foreign, $this->accessor->getPropertyValue($result, $local));
        }

        $this->storage->write($entity, $this->definition->entity())->execute();
        $this->accessor->setPropertyValue($result, $this->definition->container(), $entity);

        return $result;
    }
public function write ( & $ result ) { $ entity = $ this -> accessor -> getPropertyValue ( $ result , $ this -> definition -> container ( ) ) ; if ( empty ( $ entity ) ) { $ conditions = [ ] ; foreach ( $ this -> definition -> keys ( ) as $ local => $ foreign ) { $ conditions [ $ foreign ] [ ] = $ this -> accessor -> getPropertyValue ( $ result , $ local ) ; } $ this -> cleanup ( $ this -> definition -> entity ( ) , [ ] , $ conditions ) ; return $ result ; } $ this -> assertInstance ( $ entity ) ; foreach ( $ this -> definition -> keys ( ) as $ local => $ foreign ) { $ this -> accessor -> setPropertyValue ( $ entity , $ foreign , $ this -> accessor -> getPropertyValue ( $ result , $ local ) ) ; } $ this -> storage -> write ( $ entity , $ this -> definition -> entity ( ) ) -> execute ( ) ; $ this -> accessor -> setPropertyValue ( $ result , $ this -> definition -> container ( ) , $ entity ) ; return $ result ; }
Executes write fro one-to-one relation

@param array|\ArrayAccess $result

@return array|\ArrayAccess
@throws RelationException
Executes write fro one - to - one relation