Example #1
0
 /**
  * @param ContainerInterface $container
  * @param Configurable $config
  *
  * @return void
  */
 public function register(ContainerInterface $container, Configurable $config)
 {
     if (!$config instanceof Config) {
         throw new \InvalidArgumentException('Wrong Config object');
     }
     $logger = new Logger($config->name, $config->handlers);
     $container->add($config->getServiceName(), $logger);
 }
 /**
  * @param ContainerInterface $container
  * @param Configurable $config
  *
  * @return void
  */
 public function register(ContainerInterface $container, Configurable $config)
 {
     if (!$config instanceof Config) {
         throw new \InvalidArgumentException('Wrong Config object');
     }
     $requestFilter = new RequestFilter($config);
     $container->add($config->getServiceName(), $requestFilter);
 }
Example #3
0
 /**
  * @param ContainerInterface $container
  * @param Configurable $config
  *
  * @return void
  */
 public function register(ContainerInterface $container, Configurable $config)
 {
     if (!$config instanceof Config) {
         throw new \InvalidArgumentException('Wrong Config object');
     }
     $entityManager = EntityManager::create($config->database, Setup::createAnnotationMetadataConfiguration($config->annotationDirs, $config->dev, $config->proxyDir, $config->cache, false));
     $container->add($config->getServiceName(), $entityManager);
 }
 /**
  * @param ContainerInterface $container
  * @param Configurable $config
  *
  * @return void
  */
 public function register(ContainerInterface $container, Configurable $config)
 {
     if (!$config instanceof Config) {
         throw new \InvalidArgumentException('Wrong Config object');
     }
     $validator = Validation::createValidatorBuilder();
     if ($config->annotationMapping) {
         $validator->enableAnnotationMapping();
     }
     $container->add($config->getServiceName(), $validator->getValidator());
 }
Example #5
0
 /**
  * @param ContainerInterface $container
  * @param Configurable $config
  *
  * @return void
  */
 public function register(ContainerInterface $container, Configurable $config)
 {
     if (!$config instanceof Config) {
         throw new \InvalidArgumentException('Wrong Config object');
     }
     $hateoas = HateoasBuilder::create();
     $hateoas->setDebug($config->debug);
     $hateoas->setUrlGenerator(null, new CallableUrlGenerator($config->urlGenerator));
     if (!$config->debug) {
         $hateoas->setCacheDir($config->cacheDir);
         $hateoas->addMetadataDir($config->metadataDir);
     }
     $container->add($config->getServiceName(), $hateoas->build());
 }