Phactory\Sql\Blueprint::build PHP Method

build() public method

Note that this function ignores ManyToMany associations, as those can't be handled unless the Row is actually saved to the db.
public build ( $overrides = [], $associated = [] )
$associated [table name] => [Row]
    public function build($overrides = array(), $associated = array())
    {
        // process one-to-one and many-to-one relations
        $assoc_keys = array();
        foreach ($associated as $name => $row) {
            if (!isset($this->_associations[$name])) {
                throw new \Exception("No association '{$name}' defined");
            }
            $association = $this->_associations[$name];
            if (!$association instanceof Association\ManyToMany) {
                $fk_column = $association->getFromColumn();
                $to_column = $association->getToColumn();
                $assoc_keys[$fk_column] = $row->{$to_column};
            }
        }
        $data = array_merge($this->_defaults, $assoc_keys);
        $this->_evalSequence($data);
        $built = new Row($this->_table, $data, $this->_phactory);
        if ($overrides) {
            foreach ($overrides as $field => $value) {
                $built->{$field} = $value;
            }
        }
        return $built;
    }