Storm\Core\Relational\Transaction::SubscribeToPrePersistEvent PHP Метод

SubscribeToPrePersistEvent() публичный Метод

Subscribe a callback to when the supplied row will be persisted.
public SubscribeToPrePersistEvent ( Storm\Core\Relational\ITable $Table, callable $Event )
$Table Storm\Core\Relational\ITable
$Event callable
    public function SubscribeToPrePersistEvent(ITable $Table, callable $Event)
    {
        $this->AddEvent($this->PrePersistRowEventMap, $Table, $Event);
    }

Usage Example

Пример #1
0
 protected function PersistIdentifyingRelationship(Relational\Transaction $Transaction, Relational\ResultRow $ParentData, array $ChildRows)
 {
     if ($this->GetForeignKey()->HasReferencedKey($ParentData)) {
         foreach ($ChildRows as $ChildRow) {
             $this->MapRelationalParentDataToRelatedData($ParentData, $ChildRow);
         }
     } else {
         $Transaction->SubscribeToPrePersistEvent($this->GetTable(), function () use(&$ParentData, &$ChildRows) {
             foreach ($ChildRows as $ChildRow) {
                 $this->MapRelationalParentDataToRelatedData($ParentData, $ChildRow);
             }
         });
     }
 }
All Usage Examples Of Storm\Core\Relational\Transaction::SubscribeToPrePersistEvent