Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     $translatable = parent::create($options);
     $translatable->setLocales($this->localeContext->getLocales());
     $translatable->setFallbackLocale($this->localeContext->getFallbackLocale());
     $translatable->setTranslationClass($this->resource->getTranslation()->getModel());
     return $translatable;
 }
Ejemplo n.º 2
0
 /**
  * @param ResourceInterface $resource
  *
  * @return Definition
  */
 private function createResourceDefinition(ResourceInterface $resource)
 {
     $arguments = [$resource->getName(), $resource->getDriver(), $resource->getDriverManager(), $resource->getDriverMappingPath(), $resource->getDriverMappingFormat(), $resource->getInterfaces(), $resource->getModel(), $resource->getController(), $resource->getFactory(), $resource->getRepository(), $resource->getDomainManager(), $resource->getForm(), $resource->getChoiceForm(), $resource->getIdPropertyPath(), $resource->getLabelPropertyPath()];
     if ($resource->getTranslation() !== null) {
         $arguments[] = new Reference('lug.resource.' . $resource->getTranslation()->getName());
     }
     $definition = new Definition(Resource::class, $arguments);
     $definition->addTag('lug.resource');
     return $definition;
 }