PHP 클래스 Newscoop\NewscoopBundle\Services\TopicService

파일 보기 프로젝트 열기: sourcefabric/newscoop

보호된 프로퍼티들

프로퍼티 타입 설명
$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