0

I'm using Zend Framework version 1.x

The documentation for the refresh method of Zend_Db_Table_Row_Abstract says only:

Refreshes properties from the database.

My question is what this method will return if the row has been deleted from the database in the meantime (ie. by some other process)?

Will it be able to handle that situation by either returning null or throwing an exception?

Thanks, Jakob

jgivoni
  • 1,605
  • 1
  • 15
  • 24

1 Answers1

1

first the resfresh() just calls _refresh() and if $row === null returns an Exception.

protected function _refresh()
    {
        $where = $this->_getWhereQuery();
        $row = $this->_getTable()->fetchRow($where);

        if (null === $row) {
            require_once 'Zend/Db/Table/Row/Exception.php';
            throw new Zend_Db_Table_Row_Exception('Cannot refresh row as parent is missing');
        }

        $this->_data = $row->toArray();
        $this->_cleanData = $this->_data;
        $this->_modifiedFields = array();
    }
RockyFord
  • 8,529
  • 1
  • 15
  • 21
  • "Throws an exception" sounds like the correct answer, glancing at the source code. 'Cannot refresh row as parent is missing' probably means that refresh would also fail if any of the dependent rows in linked tabled have gone missing. – jgivoni Apr 06 '13 at 21:05