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]); }
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]); }