Sulu\Bundle\TagBundle\Tag\TagManagerInterface::findByName PHP 메소드

findByName() 공개 메소드

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

Usage Example

예제 #1
0
파일: TagList.php 프로젝트: sulu/sulu
 /**
  * {@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 '';
 }