Exemple #1
0
 public function onSet(RecordPropertyEvent $event)
 {
     $record = $event->getRecord();
     $table = $record->getTable();
     $relationName = $this->getTableConfigValue($table->getTableName(), 'delegateToRelation');
     $relation = $this->getOneToOneRelation($table, $relationName);
     if ($relation) {
         $delegateRecord = $record->get($relationName);
         if ($delegateRecord === null) {
             $delegateTable = $relation->getJoinTable($table->getRecordManager(), $relationName);
             $delegateRecord = $delegateTable->createRecord();
         }
         try {
             $delegateRecord->set($event->getProperty(), $event->getValue());
             $record->set($relationName, $delegateRecord);
             $event->stopPropagation();
         } catch (Table\TableException $e) {
         }
     }
 }
 /**
  * @param Record $record
  * @param string $property
  * @param mixed  $value
  * @param mixed  $oldValue
  */
 public function __construct(Record $record, $property, $value, $oldValue)
 {
     parent::__construct($record, $property, $value);
     $this->oldValue = $oldValue;
 }