예제 #1
0
 /**
  * Get relation referenced repository
  *
  * @param  Record $record
  * @param  string $relationName
  * @return \Dive\Table\Repository
  */
 protected function getRefRepository(Record $record, $relationName)
 {
     $rm = $record->getTable()->getRecordManager();
     $tableName = $this->relation->isReferencedSide($relationName) ? $this->relation->getReferencedTable() : $this->relation->getOwningTable();
     $refTable = $rm->getTable($tableName);
     return $refTable->getRepository();
 }
 /**
  * @param  Relation $relation
  * @param  string   $relationName
  * @return Record
  */
 private function getReferencedRecord(Relation $relation, $relationName)
 {
     return $relation->isReferencedSide($relationName) ? $this->relatedRecord : $this->storedRecord;
 }