Newscoop\NewscoopBundle\Services\TopicService::getTopicBy PHP Method

getTopicBy() public method

$string parameter value can be: "test", 20, "test:en".
public getTopicBy ( string $string, string | null $locale = null ) : Topic | null
$string string Topic search phrase
$locale string | null Locale
return Newscoop\NewscoopBundle\Entity\Topic | null
    public function getTopicBy($string, $locale = null)
    {
        $topic = $this->getTopicRepository()->getTopicByIdOrName($string, $locale)->getOneOrNullResult();
        if (!$topic) {
            $topic = $this->getTopicByFullName($string);
            if (!$topic) {
                return;
            }
        }
        return $topic;
    }