Newscoop\NewscoopBundle\Services\TopicService::checkTopicName PHP Метод

checkTopicName() публичный Метод

Check if topic name already exists by given locale.
public checkTopicName ( string $locale, string $title ) : boolean
$locale string Locale
$title string Topic name
Результат boolean
    public function checkTopicName($locale, $title)
    {
        $topicTranslation = $this->getTopicRepository()->createQueryBuilder('t')->select('count(t)')->join('t.translations', 'tt')->where('tt.locale = :locale')->andWhere('tt.content = :title')->andWhere("tt.field = 'title'")->setParameters(array('title' => $title, 'locale' => $locale))->getQuery()->getSingleScalarResult();
        if ((int) $topicTranslation > 0) {
            return true;
        }
        return false;
    }