Exemplo n.º 1
0
 /**
  * @param ResourceInterface $resource
  *
  * @return Definition
  */
 private function createResourceDefinition(ResourceInterface $resource)
 {
     $definition = new Definition(Resource::class, [$resource->getName(), $resource->getInterfaces(), $resource->getModel()]);
     $definition->addMethodCall('setDriver', [$resource->getDriver()])->addMethodCall('setDriverManager', [$resource->getDriverManager()])->addMethodCall('setDriverMappingPath', [$resource->getDriverMappingPath()])->addMethodCall('setDriverMappingFormat', [$resource->getDriverMappingFormat()])->addMethodCall('setRepository', [$resource->getRepository()])->addMethodCall('setFactory', [$resource->getFactory()])->addMethodCall('setForm', [$resource->getForm()])->addMethodCall('setChoiceForm', [$resource->getChoiceForm()])->addMethodCall('setDomainManager', [$resource->getDomainManager()])->addMethodCall('setController', [$resource->getController()])->addMethodCall('setIdPropertyPath', [$resource->getIdPropertyPath()])->addMethodCall('setLabelPropertyPath', [$resource->getLabelPropertyPath()])->addTag('lug.resource');
     foreach ($resource->getRelations() as $name => $relation) {
         $definition->addMethodCall('addRelation', [$name, new Reference('lug.resource.' . $relation->getName())]);
     }
     return $definition;
 }