public function load(Container $object)
    {
        $pks = [];
        $values = $this->parameters;
        $identifier = $this->identifier;
        foreach ($this->primaryKey as $key) {
            if (isset($object->$key)) {
                $pks[$key] = sprintf('%s.%s = ?', $identifier, $key);
                $values[] = $object->$key;
            } else {
                throw new Exception\PrimaryKey($identifier, $key);
            }
        }
        $fields = $this->fields;
        foreach ($fields as &$field) {
            $field = "$identifier.$field";
        }
        $identifier .= $this->generateJoin($fields);
        $sql = "SELECT %s FROM %s WHERE %s";
        $stmt = $this->getStatement(sprintf(
            $sql,
            implode(', ', $fields),
            $identifier,
            implode(' AND ', $pks)
        ));
        $stmt->setFetchMode(Base::FETCH_INTO, $object);
        $stmt->execute($values);
        $stmt->fetch();
        $object->markClean();
    }
public function load(Container $object)
    {
        $pks = [];
        $values = $this->parameters;
        $identifier = $this->identifier;
        foreach ($this->primaryKey as $key) {
            if (isset($object->$key)) {
                $pks[$key] = sprintf('%s.%s = ?', $identifier, $key);
                $values[] = $object->$key;
            } else {
                throw new Exception\PrimaryKey($identifier, $key);
            }
        }
        $fields = $this->fields;
        foreach ($fields as &$field) {
            $field = "$identifier.$field";
        }
        $identifier .= $this->generateJoin($fields);
        $sql = "SELECT %s FROM %s WHERE %s";
        $stmt = $this->getStatement(sprintf(
            $sql,
            implode(', ', $fields),
            $identifier,
            implode(' AND ', $pks)
        ));
        $stmt->setFetchMode(Base::FETCH_INTO, $object);
        $stmt->execute($values);
        $stmt->fetch();
        $object->markClean();
    }
public function load ( Container $ object ) { $ pks = [ ] ; $ values = $ this -> parameters ; $ identifier = $ this -> identifier ; foreach ( $ this -> primaryKey as $ key ) { if ( isset ( $ object -> $ key ) ) { $ pks [ $ key ] = sprintf ( '%s.%s = ?' , $ identifier , $ key ) ; $ values [ ] = $ object -> $ key ; } else { throw new Exception \ PrimaryKey ( $ identifier , $ key ) ; } } $ fields = $ this -> fields ; foreach ( $ fields as & $ field ) { $ field = "$identifier.$field" ; } $ identifier .= $ this -> generateJoin ( $ fields ) ; $ sql = "SELECT %s FROM %s WHERE %s" ; $ stmt = $ this -> getStatement ( sprintf ( $ sql , implode ( ', ' , $ fields ) , $ identifier , implode ( ' AND ' , $ pks ) ) ) ; $ stmt -> setFetchMode ( Base :: FETCH_INTO , $ object ) ; $ stmt -> execute ( $ values ) ; $ stmt -> fetch ( ) ; $ object -> markClean ( ) ; }
Load data into a single model.

@param Container $object A container object.
@return void
@throws Ornament\Exception\PrimaryKey if no primary key was set or could
be determined, and loading would inevitably fail.
Load data into a single model .