Storm\Drivers\Base\Relational\Traits\ForeignKey::MapParentToReferencedKey PHP Method

MapParentToReferencedKey() final public method

final public MapParentToReferencedKey ( ColumnData $ParentKeyData, ColumnData $ReferencedKeyData )
$ParentKeyData Storm\Core\Relational\ColumnData
$ReferencedKeyData Storm\Core\Relational\ColumnData
    public final function MapParentToReferencedKey(Relational\ColumnData $ParentKeyData, Relational\ColumnData $ReferencedKeyData)
    {
        $ParentKeyData = array_intersect_key($ParentKeyData->GetData(), $this->ParentColumnIdentifierMap);
        array_walk($ParentKeyData, function ($Value, $Key) use(&$ReferencedKeyData) {
            $ReferencedKeyData[$this->ReferencedColumnIdentifierMap[$this->ParentReferencedColumnIdentifierMap[$Key]]] = $Value;
        });
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @return Relational\ResultRow
  */
 protected function MapParentRowToRelatedKey(ForeignKey $ForeignKey, Relational\ResultRow $ParentRow)
 {
     if ($this->IsInversed) {
         $ParentKey = $ForeignKey->ParentKey();
         $ForeignKey->MapReferencedToParentKey($ParentRow, $ParentKey);
         return $ParentKey;
     } else {
         $ReferencedKey = $ForeignKey->ReferencedKey();
         $ForeignKey->MapParentToReferencedKey($ParentRow, $ReferencedKey);
         return $ReferencedKey;
     }
 }