Get a the row of the supplied table
final public GetRow ( Storm\Core\Relational\ITable $Table ) : |
||
$Table | Storm\Core\Relational\ITable | The table of the row to retreive |
리턴 | The matching row |
public function Persist(Relational\Transaction $Transaction, Relational\ResultRow $ParentData, Relational\RelationshipChange $RelationshipChange) { if ($RelationshipChange->HasPersistedRelationship()) { $PersistedRelationship = $RelationshipChange->GetPersistedRelationship(); if ($PersistedRelationship->IsIdentifying()) { $ParentRow = $ParentData->GetRow($this->GetParentTable()); $ChildRow = $PersistedRelationship->GetChildResultRow()->GetRow($this->GetTable()); $this->PersistIdentifyingRelationship($Transaction, $ParentRow, $ChildRow); } else { $RelatedPrimaryKey = $PersistedRelationship->GetRelatedPrimaryKey(); if ($this->IsInversed()) { $this->GetForeignKey()->MapParentToReferencedKey($RelatedPrimaryKey, $ParentData); } else { $this->GetForeignKey()->MapReferencedToParentKey($RelatedPrimaryKey, $ParentData); } } } }
public function Persist(Relational\Transaction $Transaction, Relational\ResultRow $ParentData, array $RelationshipChanges) { /* @var $RelationshipChanges Relational\RelationshipChange[] */ $JoinRowsWithoutPrimaryKeys = []; foreach ($RelationshipChanges as $RelationshipChange) { if ($RelationshipChange->HasPersistedRelationship()) { $JoinRow = $this->MapPersistedRelationshipToJoinRow($RelationshipChange->GetPersistedRelationship()); $Transaction->Persist($JoinRow); if (!$JoinRow->HasPrimaryKey()) { $JoinRowsWithoutPrimaryKeys[] = $JoinRow; } } if ($RelationshipChange->HasDiscardedRelationship()) { $JoinRow = $this->MapDiscardedRelationshipToJoinRow($RelationshipChange->GetDiscardedRelationship()); $Transaction->Discard($JoinRow->GetPrimaryKey()); } } if (count($JoinRowsWithoutPrimaryKeys) > 0) { $ParentRow = $ParentData->GetRow($this->ParentForeignKey->GetReferencedTable()); $Transaction->SubscribeToPrePersistEvent($this->JoinTable, function () use(&$ParentRow, &$JoinRowsWithoutPrimaryKeys) { foreach ($JoinRowsWithoutPrimaryKeys as $JoinRowWithoutPrimaryKey) { $this->ParentForeignKey->MapReferencedToParentKey($ParentRow, $JoinRowWithoutPrimaryKey); } }); } }