public function assignRecord(array $record, DB $database)
    {
        $dao = $this->getDAO();
        $table = $dao->getTable($database);
        $pkey = $table->getPrimaryColumns();
        if ($pkey !== null)
        {
            $this->_id = array();
            foreach ($pkey as $col)
                $this->_id[$col->getName()] = $record[$col->getName()];
        }
        else
            $this->_id = null;

        $this->_record = $record;
        $this->_changed = array();
        $this->setSourceDB($database);
        $this->init();

        $columns = $table->getColumns($database);
        foreach ($columns as $name => $def)
        {
            if (!array_key_exists($name, $this->_record))
                continue;

            $this->_record[$name] = $def->afterFetchFilter($this->_record[$name]);
            
            // Synchronize local variables
            if (property_exists($this, $name))
                $this->$name = $this->_record[$name];
        }
        return $this;
    }
public function assignRecord(array $record, DB $database)
    {
        $dao = $this->getDAO();
        $table = $dao->getTable($database);
        $pkey = $table->getPrimaryColumns();
        if ($pkey !== null)
        {
            $this->_id = array();
            foreach ($pkey as $col)
                $this->_id[$col->getName()] = $record[$col->getName()];
        }
        else
            $this->_id = null;

        $this->_record = $record;
        $this->_changed = array();
        $this->setSourceDB($database);
        $this->init();

        $columns = $table->getColumns($database);
        foreach ($columns as $name => $def)
        {
            if (!array_key_exists($name, $this->_record))
                continue;

            $this->_record[$name] = $def->afterFetchFilter($this->_record[$name]);
            
            // Synchronize local variables
            if (property_exists($this, $name))
                $this->$name = $this->_record[$name];
        }
        return $this;
    }
public function assignRecord ( array $ record , DB $ database ) { $ dao = $ this -> getDAO ( ) ; $ table = $ dao -> getTable ( $ database ) ; $ pkey = $ table -> getPrimaryColumns ( ) ; if ( $ pkey !== null ) { $ this -> _id = array ( ) ; foreach ( $ pkey as $ col ) $ this -> _id [ $ col -> getName ( ) ] = $ record [ $ col -> getName ( ) ] ; } else $ this -> _id = null ; $ this -> _record = $ record ; $ this -> _changed = array ( ) ; $ this -> setSourceDB ( $ database ) ; $ this -> init ( ) ; $ columns = $ table -> getColumns ( $ database ) ; foreach ( $ columns as $ name => $ def ) { if ( ! array_key_exists ( $ name , $ this -> _record ) ) continue ; $ this -> _record [ $ name ] = $ def -> afterFetchFilter ( $ this -> _record [ $ name ] ) ; // Synchronize local variables if ( property_exists ( $ this , $ name ) ) $ this -> $ name = $ this -> _record [ $ name ] ; } return $ this ; }
Assign the provided record to this object.
@param array $record The record obtained from the database.
@param Wedeto\DB\DB $database The database this record comes from
@return Wedeto\DB\DAO Provides fluent interface
Assign the provided record to this object .