Library/Bullhorn/FastRest/Api/Models/Base.php
public function setRelated($alias, Model $entity) {
        $foundRelation = $this->getRelationship($alias);
        if($foundRelation instanceof CustomRelationship) {
            call_user_func(array($this, 'set' . ucfirst($alias)), $entity);
        } else {
            $attribute = $foundRelation->getFields();
            $value = $foundRelation->getReferencedFields();
            if(is_array($attribute)) {
                $count = sizeOf($attribute);
                for($i = 0; $i < $count; $i++) {
                    $this->writeAttribute($attribute[$i], $entity->readAttribute($value[$i]));
                }
            } else {
                $this->writeAttribute($attribute, $entity->readAttribute($value));
            }
        }
    }
public function setRelated($alias, Model $entity) {
        $foundRelation = $this->getRelationship($alias);
        if($foundRelation instanceof CustomRelationship) {
            call_user_func(array($this, 'set' . ucfirst($alias)), $entity);
        } else {
            $attribute = $foundRelation->getFields();
            $value = $foundRelation->getReferencedFields();
            if(is_array($attribute)) {
                $count = sizeOf($attribute);
                for($i = 0; $i < $count; $i++) {
                    $this->writeAttribute($attribute[$i], $entity->readAttribute($value[$i]));
                }
            } else {
                $this->writeAttribute($attribute, $entity->readAttribute($value));
            }
        }
    }
public function setRelated ( $ alias , Model $ entity ) { $ foundRelation = $ this -> getRelationship ( $ alias ) ; if ( $ foundRelation instanceof CustomRelationship ) { call_user_func ( array ( $ this , 'set' . ucfirst ( $ alias ) ) , $ entity ) ; } else { $ attribute = $ foundRelation -> getFields ( ) ; $ value = $ foundRelation -> getReferencedFields ( ) ; if ( is_array ( $ attribute ) ) { $ count = sizeOf ( $ attribute ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> writeAttribute ( $ attribute [ $ i ] , $ entity -> readAttribute ( $ value [ $ i ] ) ) ; } } else { $ this -> writeAttribute ( $ attribute , $ entity -> readAttribute ( $ value ) ) ; } } }
Sets a related entity

@param string $alias
@param Model $entity

@return void
Sets a related entity