public function unsetRelation($name, $value)
    {
        list($type, $foreign_class, $foreign_column, $column) = static::getRelationDefinition($name);

        //no need to get the relation, the column is on this object.
        if ($type === 'belongs_to') {
            $this->setRaw($column, $value);
            $this->relation_objects[$name] = false;

            return;
        }

        $related_object = $this->getRelation($name);

        if (!$related_object) {
            return;
        }

        //has one, the related object column is set to the value.
        if ($type === 'has_one') {
            $related_object->setRaw($foreign_column, $value);
            $this->relation_objects[$name] = false;
        }

        //has many, the columns on the entities in the related
        //collection are set to the value.
        if ($type === 'has_many') {
            $related_object->setColumnRaw($foreign_column, $value);
            $this->relation_objects[$name] = $foreign_class::newCollection();
        }

        return;
    }
public function unsetRelation($name, $value)
    {
        list($type, $foreign_class, $foreign_column, $column) = static::getRelationDefinition($name);

        //no need to get the relation, the column is on this object.
        if ($type === 'belongs_to') {
            $this->setRaw($column, $value);
            $this->relation_objects[$name] = false;

            return;
        }

        $related_object = $this->getRelation($name);

        if (!$related_object) {
            return;
        }

        //has one, the related object column is set to the value.
        if ($type === 'has_one') {
            $related_object->setRaw($foreign_column, $value);
            $this->relation_objects[$name] = false;
        }

        //has many, the columns on the entities in the related
        //collection are set to the value.
        if ($type === 'has_many') {
            $related_object->setColumnRaw($foreign_column, $value);
            $this->relation_objects[$name] = $foreign_class::newCollection();
        }

        return;
    }
public function unsetRelation ( $ name , $ value ) { list ( $ type , $ foreign_class , $ foreign_column , $ column ) = static :: getRelationDefinition ( $ name ) ; //no need to get the relation, the column is on this object. if ( $ type === 'belongs_to' ) { $ this -> setRaw ( $ column , $ value ) ; $ this -> relation_objects [ $ name ] = false ; return ; } $ related_object = $ this -> getRelation ( $ name ) ; if ( ! $ related_object ) { return ; } //has one, the related object column is set to the value. if ( $ type === 'has_one' ) { $ related_object -> setRaw ( $ foreign_column , $ value ) ; $ this -> relation_objects [ $ name ] = false ; } //has many, the columns on the entities in the related //collection are set to the value. if ( $ type === 'has_many' ) { $ related_object -> setColumnRaw ( $ foreign_column , $ value ) ; $ this -> relation_objects [ $ name ] = $ foreign_class :: newCollection ( ) ; } return ; }
Unset a related object and assign the joining column a
value. If the related object has not been fetched, it will be
fetched and the joining column changed.

@param string $name  The name of the relation
@param mixed  $value The value to assign to the joining column
Unset a related object and assign the joining column a value . If the related object has not been fetched it will be fetched and the joining column changed .