/**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $generator = new ObjectDefinition(UrlGenerator::class);
     $generator->setConstructorArguments($this->namespace, new Reference('routes'));
     $function = new ExtendDefinition(Twig_Environment::class);
     $function->addMethodCall('addFunction', new Twig_SimpleFunction('url', function ($action, $parameters = []) {
         return $this->container->get(UrlGenerator::class)->to($action, $parameters);
     }));
     return [UrlGenerator::class => $generator, $function];
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $routes = new ExtendDefinition(RouteCollection::class);
     $routes->addMethodCall('get', '/', [$this, 'welcomeScreen']);
     return [$routes];
 }
 /**
  * Returns the definition to register in the container.
  *
  * @return DefinitionInterface[]
  */
 public function getDefinitions()
 {
     $assets = new ExtendDefinition(Twig_Environment::class);
     $assets->addMethodCall('addGlobal', 'assets', $this->getWebpackAssets());
     return [$assets];
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $phinx = new ExtendDefinition(Application::class);
     $phinx->addMethodCall('addCommands', [$this->getCommand(new Command\Create()), $this->getCommand(new Command\Migrate()), $this->getCommand(new Command\Rollback()), $this->getCommand(new Command\Status())]);
     return [$phinx];
 }