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

getTopicByFullNameAsArray() public method

Returns a topic as an array identified by the full name in the format topic_name:language_code.
public getTopicByFullNameAsArray ( string $fullName ) : array
$fullName string Topic's full name
return array
    public function getTopicByFullNameAsArray($fullName)
    {
        $extractedData = $this->extractNameAndLanguage($fullName);
        if (empty($extractedData)) {
            return;
        }
        $name = $extractedData['name'];
        $languageCode = $extractedData['locale'];
        $topicTranslation = $this->em->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic')->getOneByExtractedFullName($name, $languageCode)->getArrayResult();
        if (empty($topicTranslation)) {
            return;
        }
        $topicTranslation[0]['object']['title'] = $topicTranslation[0]['title'];
        return $topicTranslation[0]['object'];
    }