src/ActiveDoctrine/Entity/Entity.php
/**
     * Set the named related object and ensure the joining columns are
     * matched. If $related_object is not an Entity or
     * EntityCollection, the relationship will be removed.
     *
     * @param string $name           The name of the relation
     * @param mixed  $related_object The related object
     */
Set the named related object and ensure the joining columns are
matched. If $related_object is not an Entity or
EntityCollection, the relationship will be removed.

@param string $name           The name of the relation
@param mixed  $related_object The related object
Set the named related object and ensure the joining columns are matched . If $related_object is not an Entity or EntityCollection the relationship will be removed . @param string $name The name of the relation @param mixed $related_object The related object
public function associateRelation($name, $related_object)
    {
        if (!$related_object instanceof Entity && !$related_object instanceof EntityCollection) {
            return $this->unsetRelation($name, $related_object);
        }
        list($type, $foreign_class, $foreign_column, $column) = static::getRelationDefinition($name);
        $this->setRelation($name, $related_object);
        if ($type === 'has_one') {
            $related_object->setRaw($foreign_column, $this->getRaw($column));
        }
        if ($type === 'belongs_to') {
            $this->setRaw($column, $related_object->getRaw($foreign_column));
        }
        if ($type === 'has_many') {
            $related_object->setColumn($foreign_column, $this->getRaw($column));
        }
    }
public function associateRelation ( $ name , $ related_object ) { if ( ! $ related_object instanceof Entity && ! $ related_object instanceof EntityCollection ) { return $ this -> unsetRelation ( $ name , $ related_object ) ; } list ( $ type , $ foreign_class , $ foreign_column , $ column ) = static :: getRelationDefinition ( $ name ) ; $ this -> setRelation ( $ name , $ related_object ) ; if ( $ type === 'has_one' ) { $ related_object -> setRaw ( $ foreign_column , $ this -> getRaw ( $ column ) ) ; } if ( $ type === 'belongs_to' ) { $ this -> setRaw ( $ column , $ related_object -> getRaw ( $ foreign_column ) ) ; } if ( $ type === 'has_many' ) { $ related_object -> setColumn ( $ foreign_column , $ this -> getRaw ( $ column ) ) ; } }
Set the named related object and ensure the joining columns are
 matched.
Set the named related object and ensure the joining columns are matched .