ActiveRecord\AbstractRelationship::build_association PHP Method

build_association() public method

Creates a new instance of specified {@link Model} with the attributes pre-loaded.
public build_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model
$model activerecord\Model The model which holds this association
$attributes array Hash containing attributes to initialize the model with
return activerecord\Model
    public function build_association(Model $model, $attributes = array(), $guard_attributes = true)
    {
        $class_name = $this->class_name;
        return new $class_name($attributes, $guard_attributes);
    }