public function transform(Update $update) { $r_type = $update->updateType(); $class = $update->entityClass(); if ($class == Entity::class) { foreach ($this->known() as $model) { if ($model->updateType() == $r_type) { return $model->newFromBuilder($update->getAttributes()); } } // throw new \Exception("Unknown update type [$r_type] for entity class [$class]"); } return $update; }