Skip to content

Instantly share code, notes, and snippets.

@matej21
Last active August 29, 2015 14:06
Show Gist options
  • Save matej21/91c082ec938c40534a18 to your computer and use it in GitHub Desktop.
Save matej21/91c082ec938c40534a18 to your computer and use it in GitHub Desktop.
<?php
public function beforeCompile()
{
$navigationFactory = $builder->getDefinition($this->prefix('navigationFactory'));
$priorityQueue = new \SplPriorityQueue();
foreach ($builder->findByTag(self::NAVIGATION_CONTRIBUTOR) as $name => $attrs) {
$priorityQueue->insert('@' . $name, is_array($attrs) && isset($attrs['priority']) ? $attrs['priority'] : self::DEFAULT_NAVIGATION_CONTRIBUTOR_PRIORITY);
}
foreach ($priorityQueue as $entry) {
$navigationFactory->addSetup('addContributor', [$entry]);
}
<?php
public function beforeCompile()
{
$builder = $this->getContainerBuilder();
$router = $builder->getDefinition('router');
$router->addSetup('offsetSet', array(new PhpLiteral('NULL'), new Statement($this->prefix('@router::create'))));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment