/** * {@inheritdoc} */ public function create(CrudableInterface $object) { $class = $object->getCrudClass(); if (!class_exists($class)) { throw new \InvalidArgumentException('Not found CRUD class.'); } $reflector = new \ReflectionClass($class); if (!$reflector->implementsInterface(CrudInterface::class)) { throw new \InvalidArgumentException('Class is not implement CrudInterface.'); } /** @var CrudInterface $crud */ $crud = new $class(); $crud->setContainer($this->container); $crud->setRelated($object); return $crud; }
/** * {@inheritdoc} */ public function setRelated(CrudableInterface $related) { $this->related = $related; $this->options = $this->optionsResolver->resolve($related->getCrudOptions()); }