src/Mapper/Relation/HasMany.php
public function add(EntityAdded $event)
    {
        $entity = $event->getEntity();
        $table = $this->getParentTableName();
        $pmk = $this->getParentPrimaryKey();
        $value = $event->getCollection()->parentEntity()->getId();
        Sql::createSql($this->getAdapter())
            ->update($table)
            ->set([$this->getForeignKey() => $value])
            ->where(["{$pmk} = :id" => [':id' => $entity->getId()]])
            ->execute();
    }
public function add(EntityAdded $event)
    {
        $entity = $event->getEntity();
        $table = $this->getParentTableName();
        $pmk = $this->getParentPrimaryKey();
        $value = $event->getCollection()->parentEntity()->getId();
        Sql::createSql($this->getAdapter())
            ->update($table)
            ->set([$this->getForeignKey() => $value])
            ->where(["{$pmk} = :id" => [':id' => $entity->getId()]])
            ->execute();
    }
public function add ( EntityAdded $ event ) { $ entity = $ event -> getEntity ( ) ; $ table = $ this -> getParentTableName ( ) ; $ pmk = $ this -> getParentPrimaryKey ( ) ; $ value = $ event -> getCollection ( ) -> parentEntity ( ) -> getId ( ) ; Sql :: createSql ( $ this -> getAdapter ( ) ) -> update ( $ table ) -> set ( [ $ this -> getForeignKey ( ) => $ value ] ) -> where ( [ "{$pmk} = :id" => [ ':id' => $ entity -> getId ( ) ] ] ) -> execute ( ) ; }
Saves the relation foreign key upon entity add

@param EntityAdded $event
Saves the relation foreign key upon entity add