/**
  * {@inheritdoc}
  *
  * Parameters:
  *      groupName
  *      entityClass
  */
 public function getLabel(array $parameters)
 {
     $label = self::DEFAULT_GROUP === $parameters['groupName'] ? self::DEFAULT_LABEL : sprintf(self::DEFAULT_GROUP_LABEL, $parameters['groupName']);
     $result = $this->translator->trans($label);
     if (!empty($parameters['entityClass']) && false !== strpos($result, self::ENTITY_NAME_PLACEHOLDER)) {
         $entityNameLabel = EntityLabelBuilder::getEntityLabelTranslationKey($parameters['entityClass']);
         $result = str_replace(self::ENTITY_NAME_PLACEHOLDER, $this->translator->trans($entityNameLabel), $result);
     }
     return $result;
 }
Exemplo n.º 2
0
 public function testGetEntityLabelTranslationKey()
 {
     $this->assertEquals('acme.product.entity_label', EntityLabelBuilder::getEntityLabelTranslationKey('Acme\\Bundle\\ProductBundle\\Entity\\Product'));
 }