PHP Класс Newscoop\NewscoopBundle\Services\TopicService

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$dispatcher
$em

Открытые методы

Метод Описание
__construct ( EntityManager $em, EventDispatcher $dispatcher )
addTopicToArticle ( Topic $topic, Article $article ) : boolean Adds topic to the article.
checkTopicName ( string $locale, string $title ) : boolean Check if topic name already exists by given locale.
countArticleTopicsBy ( array $criteria = [] ) : integer Count article topics by given criteria.
countBy ( array $criteria = [] ) : integer Count topics by given criteria.
deleteTopic ( Topic $topic ) : boolean Deletes the topic. If topic is attached to any article it is first detached and deleted.
getMultiOptions ( ) : array Get options for forms.
getReadablePath ( Topic $topic, string | null $locale = null ) : string Wrapper method for getting readable topic path.
getTopicBy ( string $string, string | null $locale = null ) : Topic | null Gets the topic by id, its title or title combined with the language and language code.
getTopicByFullName ( string $fullName ) : Topic | null Returns a topic object identified by the full name in the format topic_name:language_code.
getTopicByFullNameAsArray ( string $fullName ) : array Returns a topic as an array identified by the full name in the format topic_name:language_code.
isAttached ( string | integer $topicId, boolean $attachedCount = false ) : boolean | array Checks if topic is attached to any article.
isFollowed ( string | integer $topicId ) : boolean | array Checks if topic is attached to any article.
removeTopicFromAllArticles ( string | integer $topicId ) : boolean Removes topic from all articles it is attached to.
removeTopicFromAllUsers ( string | integer $topicId ) : boolean Removes topic from all users it is followed by.
removeTopicFromArticle ( Topic $topic, Article $article ) : boolean Removes topic from the article.
reorderRootNodes ( array $rootNodes, array $order = [] ) : boolean Reorder root topics.
saveNewTopic ( Topic $node, string | null $locale = null ) : boolean Saves new topic. Possibility to overwrite AUTO strategy (set custom ids).
saveTopicPosition ( Topic $node, array $params ) : boolean Saves topic position when it was dragged and dropped.
setTranslatableHint ( Doctrine\ORM\Query $query, string $locale = null ) : Doctrine\ORM\Query Wrapper method for setting translatable hint.

Защищенные методы

Метод Описание
attachTopicToArticle ( Topic $topic, Article $article ) : boolean Adds topic to the article.
detachTopicFromArticle ( Topic $topic, Article $article ) : boolean Removes topic from the article.
getArticleTopicRepository ( ) : Newscoop\Entity\Repository\ArticleTopicRepository Gets article topic Repository.
getTopicRepository ( ) : Newscoop\NewscoopBundle\Entity\Repository\TopicRepository Gets Topic Repository.

Приватные методы

Метод Описание
extractNameAndLanguage ( $fullName )
getLogArray ( Topic $topic, Article $article )

Описание методов

__construct() публичный метод

public __construct ( EntityManager $em, EventDispatcher $dispatcher )
$em Doctrine\ORM\EntityManager
$dispatcher EventDispatcher

addTopicToArticle() публичный метод

Adds topic to the article.
public addTopicToArticle ( Topic $topic, Article $article ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic object
$article Newscoop\Entity\Article Article object
Результат boolean

attachTopicToArticle() защищенный метод

Adds topic to the article.
protected attachTopicToArticle ( Topic $topic, Article $article ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic object
$article Newscoop\Entity\Article Article object
Результат boolean

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

countArticleTopicsBy() публичный метод

Count article topics by given criteria.
public countArticleTopicsBy ( array $criteria = [] ) : integer
$criteria array
Результат integer

countBy() публичный метод

Count topics by given criteria.
public countBy ( array $criteria = [] ) : integer
$criteria array
Результат integer

deleteTopic() публичный метод

Deletes the topic. If topic is attached to any article it is first detached and deleted.
public deleteTopic ( Topic $topic ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic
Результат boolean

detachTopicFromArticle() защищенный метод

Removes topic from the article.
protected detachTopicFromArticle ( Topic $topic, Article $article ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic object
$article Newscoop\Entity\Article Article object
Результат boolean

getArticleTopicRepository() защищенный метод

Gets article topic Repository.
protected getArticleTopicRepository ( ) : Newscoop\Entity\Repository\ArticleTopicRepository
Результат Newscoop\Entity\Repository\ArticleTopicRepository

getMultiOptions() публичный метод

Get options for forms.
public getMultiOptions ( ) : array
Результат array

getReadablePath() публичный метод

Wrapper method for getting readable topic path.
public getReadablePath ( Topic $topic, string | null $locale = null ) : string
$topic Newscoop\NewscoopBundle\Entity\Topic Topic object
$locale string | null Locale e.g. "en"
Результат string Topic's readable path

getTopicBy() публичный метод

$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
Результат Newscoop\NewscoopBundle\Entity\Topic | null

getTopicByFullName() публичный метод

Returns a topic object identified by the full name in the format topic_name:language_code.
public getTopicByFullName ( string $fullName ) : Topic | null
$fullName string Topic's full name
Результат Newscoop\NewscoopBundle\Entity\Topic | null object

getTopicByFullNameAsArray() публичный метод

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
Результат array

getTopicRepository() защищенный метод

Gets Topic Repository.
protected getTopicRepository ( ) : Newscoop\NewscoopBundle\Entity\Repository\TopicRepository
Результат Newscoop\NewscoopBundle\Entity\Repository\TopicRepository

isAttached() публичный метод

If $attachedCount is set to yes, returns an array with the number of topics attached to articles, else returns boolean. By default set to false.
public isAttached ( string | integer $topicId, boolean $attachedCount = false ) : boolean | array
$topicId string | integer Topic id
$attachedCount boolean Switch to include/exclude number of topics
Результат boolean | array

isFollowed() публичный метод

If $attachedCount is set to yes, returns an array with the number of topics attached to articles, else returns boolean. By default set to false.
public isFollowed ( string | integer $topicId ) : boolean | array
$topicId string | integer Topic id
Результат boolean | array

removeTopicFromAllArticles() публичный метод

Removes topic from all articles it is attached to.
public removeTopicFromAllArticles ( string | integer $topicId ) : boolean
$topicId string | integer Topic id
Результат boolean

removeTopicFromAllUsers() публичный метод

Removes topic from all users it is followed by.
public removeTopicFromAllUsers ( string | integer $topicId ) : boolean
$topicId string | integer Topic id
Результат boolean

removeTopicFromArticle() публичный метод

Removes topic from the article.
public removeTopicFromArticle ( Topic $topic, Article $article ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic object
$article Newscoop\Entity\Article Article object
Результат boolean

reorderRootNodes() публичный метод

Reorder root topics.
public reorderRootNodes ( array $rootNodes, array $order = [] ) : boolean
$rootNodes array Root topics
$order array Topics ids in order
Результат boolean

saveNewTopic() публичный метод

Saves new topic. Possibility to overwrite AUTO strategy (set custom ids).
public saveNewTopic ( Topic $node, string | null $locale = null ) : boolean
$node Newscoop\NewscoopBundle\Entity\Topic Topic object
$locale string | null Language code
Результат boolean

saveTopicPosition() публичный метод

Saves topic position when it was dragged and dropped.
public saveTopicPosition ( Topic $node, array $params ) : boolean
$node Newscoop\NewscoopBundle\Entity\Topic Dragged topic object
$params array Parameters with positions
Результат boolean

setTranslatableHint() публичный метод

When for instance getting topic with German name $locale should be set to "de".
public setTranslatableHint ( Doctrine\ORM\Query $query, string $locale = null ) : Doctrine\ORM\Query
$query Doctrine\ORM\Query Query object
$locale string Locale
Результат Doctrine\ORM\Query

Описание свойств

$dispatcher защищенное свойство

protected $dispatcher

$em защищенное свойство

protected $em