public function refresh() { if (!$this->_exists) { return; } $identifier = $this->getIdentifier(); $values = $this->_table->findByPk($identifier, RecordManager::FETCH_SINGLE_ARRAY); if ($values !== false) { $this->_data = $values; $this->_modifiedFields = array(); } else { $this->_exists = false; } }
/** * NOTE Table should use a different record manager than generator to use different table repositories * * @param \Dive\Record\Generator\RecordGenerator $generator * @param Table $table * @param string $recordKey * @return Record */ protected function getGeneratedRecord(RecordGenerator $generator, Table $table, $recordKey) { $tableName = $table->getTableName(); $pk = $generator->getRecordIdFromMap($tableName, $recordKey); if ($table->hasCompositePrimaryKey()) { $pk = explode(Record::COMPOSITE_ID_SEPARATOR, $pk); } $record = $table->findByPk($pk); $message = "Could not load record for '{$recordKey}' in table '{$tableName}'"; $this->assertInstanceOf('\\Dive\\Record', $record, $message); return $record; }