fireEvent() public method

Fires event.
public fireEvent ( string $method, array $args = [] )
$method string
$args array
Example #1
0
 protected function processMySQLAutoupdate(IEntity $entity, array $args)
 {
     $this->connection->queryArgs($args);
     $primary = [];
     $id = (array) ($entity->isPersisted() ? $entity->getPersistedId() : $this->connection->getLastInsertedId());
     foreach ($this->getStorageReflection()->getStoragePrimaryKey() as $key) {
         $primary[$key] = array_shift($id);
     }
     $row = $this->connection->query('SELECT %ex FROM %table WHERE %and', $this->getAutoupdateReselectExpression(), $this->getTableName(), $primary)->fetch();
     $data = $this->getStorageReflection()->convertStorageToEntity($row->toArray());
     $entity->fireEvent('onRefresh', [$data]);
 }
Example #2
0
 protected function fireEvent(IEntity $entity, $event)
 {
     if (!property_exists($this, $event)) {
         throw new InvalidArgumentException("Event '{$event}' is not defined.");
     }
     $entity->fireEvent($event);
     ObjectMixin::call($this, $event, [$entity]);
 }