Author: Elliot Levin (elliot@aanet.com.au)
Example #1
0
 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, Relational\RelationshipChange $RelationshipChange)
 {
     if ($RelationshipChange->HasDiscardedRelationship() || $RelationshipChange->HasPersistedRelationship()) {
         $this->ToOneRelation->Persist($Transaction, $ParentData, $RelationshipChange);
     }
 }