Example #1
0
 /**
  * @return array|string|null
  */
 public function getIdentifier()
 {
     $identifier = $this->getIdentifierFieldIndexed();
     if ($identifier === null) {
         return null;
     }
     return $this->_table->hasCompositePrimaryKey() ? $identifier : current($identifier);
 }
Example #2
0
 /**
  * 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;
 }