Skip to content

Commit

Permalink
Merge branch '1.0' into 1.1
Browse files Browse the repository at this point in the history
* 1.0:
  Outdated method reference removed from docs
  Cleanup PrioritizedCompositeServicePass definition name
  • Loading branch information
pamil committed Apr 5, 2018
2 parents 417287f + 9b8852e commit 3e48ee5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions docs/cookbook/shop/taxons-menu.rst
Expand Up @@ -16,8 +16,9 @@ How to do it?

You can render such a menu wherever you have access to a ``category`` variable in the view, but also anywhere else.

The ``findChildrenAsTreeByRootCode`` method of **TaxonRepository** takes either a ``code`` or null. If the code is null it returns the whole
tree of taxons configured in the database.
The ``findChildren`` method of **TaxonRepository** takes a ``parentCode`` and nullable ``locale``.

If ``locale`` parameter is not null the method returns also taxon's translation based on given ``locale``.

To render a simple menu of categories in any twig template use:

Expand Down
Expand Up @@ -72,11 +72,11 @@ public function process(ContainerBuilder $container): void
*/
private function injectTaggedServicesIntoComposite(ContainerBuilder $container): void
{
$channelContextDefinition = $container->findDefinition($this->compositeId);
$contextDefinition = $container->findDefinition($this->compositeId);

$taggedServices = $container->findTaggedServiceIds($this->tagName);
foreach ($taggedServices as $id => $tags) {
$this->addMethodCalls($channelContextDefinition, $id, $tags);
$this->addMethodCalls($contextDefinition, $id, $tags);
}
}

Expand All @@ -93,30 +93,30 @@ private function addAliasForCompositeIfServiceDoesNotExist(ContainerBuilder $con
}

/**
* @param Definition $channelContextDefinition
* @param Definition $contextDefinition
* @param string $id
* @param array $tags
*/
private function addMethodCalls(Definition $channelContextDefinition, string $id, array $tags): void
private function addMethodCalls(Definition $contextDefinition, string $id, array $tags): void
{
foreach ($tags as $attributes) {
$this->addMethodCall($channelContextDefinition, $id, $attributes);
$this->addMethodCall($contextDefinition, $id, $attributes);
}
}

/**
* @param Definition $channelContextDefinition
* @param Definition $contextDefinition
* @param string $id
* @param array $attributes
*/
private function addMethodCall(Definition $channelContextDefinition, string $id, array $attributes): void
private function addMethodCall(Definition $contextDefinition, string $id, array $attributes): void
{
$arguments = [new Reference($id)];

if (isset($attributes['priority'])) {
$arguments[] = $attributes['priority'];
}

$channelContextDefinition->addMethodCall($this->methodName, $arguments);
$contextDefinition->addMethodCall($this->methodName, $arguments);
}
}

0 comments on commit 3e48ee5

Please sign in to comment.