src/db/orm/PersistableObject.php
public function reload($resetRelations = false) {   // TODO: implement and set default=TRUE
        if (!$this->isPersistent()) throw new IllegalStateException('Cannot reload non-persistent '.get_class($this));

        // TODO: This method cannot yet handle composite primary keys.

        $db     = $this->db();
        $dao    = $this->dao();
        $entity = $dao->getEntityMapping();
        $table  = $entity->getTableName();

        // collect identity infos
        $identity = $entity->getIdentity();
        $idColumn = $identity->getColumn();
        $idName   = $identity->getName();
        $idValue  = $identity->convertToDBValue($this->$idName, $db);

        // create and execute SQL
        $sql = 'select *
                   from '.$table.'
                   where '.$idColumn.' = '.$idValue;
        $row = $db->query($sql)->fetchRow();
        if ($row === null) throw new ConcurrentModificationException('Error reloading '.get_class($this).' ('.$this->getObjectId().'), record not found');

        // apply record values
        return $this->populate($row);
    }
public function reload($resetRelations = false) {   // TODO: implement and set default=TRUE
        if (!$this->isPersistent()) throw new IllegalStateException('Cannot reload non-persistent '.get_class($this));

        // TODO: This method cannot yet handle composite primary keys.

        $db     = $this->db();
        $dao    = $this->dao();
        $entity = $dao->getEntityMapping();
        $table  = $entity->getTableName();

        // collect identity infos
        $identity = $entity->getIdentity();
        $idColumn = $identity->getColumn();
        $idName   = $identity->getName();
        $idValue  = $identity->convertToDBValue($this->$idName, $db);

        // create and execute SQL
        $sql = 'select *
                   from '.$table.'
                   where '.$idColumn.' = '.$idValue;
        $row = $db->query($sql)->fetchRow();
        if ($row === null) throw new ConcurrentModificationException('Error reloading '.get_class($this).' ('.$this->getObjectId().'), record not found');

        // apply record values
        return $this->populate($row);
    }
public function reload ( $ resetRelations = false ) { // TODO: implement and set default=TRUE if ( ! $ this -> isPersistent ( ) ) throw new IllegalStateException ( 'Cannot reload non-persistent ' . get_class ( $ this ) ) ; // TODO: This method cannot yet handle composite primary keys. $ db = $ this -> db ( ) ; $ dao = $ this -> dao ( ) ; $ entity = $ dao -> getEntityMapping ( ) ; $ table = $ entity -> getTableName ( ) ; // collect identity infos $ identity = $ entity -> getIdentity ( ) ; $ idColumn = $ identity -> getColumn ( ) ; $ idName = $ identity -> getName ( ) ; $ idValue = $ identity -> convertToDBValue ( $ this -> $ idName , $ db ) ; // create and execute SQL $ sql = 'select *
                   from ' . $ table . '
                   where ' . $ idColumn . ' = ' . $ idValue ; $ row = $ db -> query ( $ sql ) -> fetchRow ( ) ; if ( $ row === null ) throw new ConcurrentModificationException ( 'Error reloading ' . get_class ( $ this ) . ' (' . $ this -> getObjectId ( ) . '), record not found' ) ; // apply record values return $ this -> populate ( $ row ) ; }
Reload this instance from the database and optionally reset relations.

@param  bool $resetRelations [optional] - NOT YET IMPLEMENTED
Whether to reset relations and re-fetch on next access.
(default: no)
@return $this
Reload this instance from the database and optionally reset relations .