Sulu\Bundle\TagBundle\Tag\TagManagerInterface::findByName PHP Method

findByName() public method

Loads the tag with the given name.
public findByName ( $name ) : Tag
$name
return Sulu\Bundle\TagBundle\Entity\Tag
    public function findByName($name);

Usage Example

Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function exportData($propertyValue)
 {
     if (false === is_array($propertyValue)) {
         return '';
     }
     foreach ($propertyValue as &$propertyValueItem) {
         if (is_string($propertyValueItem)) {
             $tag = $this->tagManager->findByName($propertyValueItem);
             if ($tag) {
                 $propertyValueItem = $tag->getId();
             }
         }
     }
     if (!empty($propertyValue)) {
         return json_encode($propertyValue);
     }
     return '';
 }