PHP Class Newscoop\Services\CommentService

Show file Open project: sourcefabric/newscoop

Protected Properties

Property Type Description
$em Doctrine\ORM\EntityManager

Public Methods

Method Description
__construct ( EntityManager $em, PublicationService $publicationService )
countBy ( array $criteria ) : integer Get total count for given criteria
find ( integer $id ) : Newscoop\Entity\Comment Find a comment by its id.
findBy ( array $criteria, array | null $orderBy = null, integer | null $limit = null, integer | null $offset = null ) : array Find records by set of criteria
findUserComments ( array $params, array $order, integer $limit, integer $start ) : array Gets all replies to a comment.
getAllReplies ( integer | array $commentId, Newscoop\Repository\CommentRepository $commentRepository ) : array Gets all replies to a comment.
getArticleStats ( mixed $ids ) : array Get comments statistics for articles
getCommentCounts ( array $ids, $recommended = false, $all = false ) : array Get articles comment counts
getRepository ( ) : Newscoop\Entity\Repository\CommentRepository Get repository for comment entity
isBanned ( Newscoop\Entity\Comment\Commenter $commenter ) : boolean Checks if a commenter is banned
remove ( Comment $comment ) : Comment Mark comment as removed
save ( Comment $comment, array $attributes, $userId = null ) : Comment Save (create new/update) comment (with commenter)
searchByPhrase ( string $phrase ) : Doctrine\ORM\QueryBuilder Searchs comments by given phrase
update ( GenericEvent $event ) : void Receives notifications of points events.
updateComment ( Comment $comment, array $attributes ) : Comment Update comment

Private Methods

Method Description
comment_create ( $params )
comment_delete ( $params )
comment_recommended ( $params )
comment_update ( $params )
getCommentsEnabled ( array $ids ) Get article comments_enabled

Method Details

__construct() public method

public __construct ( EntityManager $em, PublicationService $publicationService )
$em Doctrine\ORM\EntityManager
$publicationService PublicationService

countBy() public method

Get total count for given criteria
public countBy ( array $criteria ) : integer
$criteria array
return integer

find() public method

Find a comment by its id.
public find ( integer $id ) : Newscoop\Entity\Comment
$id integer
return Newscoop\Entity\Comment

findBy() public method

Find records by set of criteria
public findBy ( array $criteria, array | null $orderBy = null, integer | null $limit = null, integer | null $offset = null ) : array
$criteria array
$orderBy array | null
$limit integer | null
$offset integer | null
return array

findUserComments() public method

Gets all replies to a comment.
public findUserComments ( array $params, array $order, integer $limit, integer $start ) : array
$params array Parameters
$order array Order
$limit integer Result limit
$start integer Result start
return array

getAllReplies() public method

Gets all replies to a comment.
public getAllReplies ( integer | array $commentId, Newscoop\Repository\CommentRepository $commentRepository ) : array
$commentId integer | array Comment id
$commentRepository Newscoop\Repository\CommentRepository Comment repository
return array

getArticleStats() public method

Get comments statistics for articles
public getArticleStats ( mixed $ids ) : array
$ids mixed
return array

getCommentCounts() public method

Get articles comment counts
public getCommentCounts ( array $ids, $recommended = false, $all = false ) : array
$ids array
return array

getRepository() public method

Get repository for comment entity
public getRepository ( ) : Newscoop\Entity\Repository\CommentRepository
return Newscoop\Entity\Repository\CommentRepository

isBanned() public method

Checks if a commenter is banned
public isBanned ( Newscoop\Entity\Comment\Commenter $commenter ) : boolean
$commenter Newscoop\Entity\Comment\Commenter Commenter
return boolean

remove() public method

Mark comment as removed
public remove ( Comment $comment ) : Comment
$comment Newscoop\Entity\Comment
return Newscoop\Entity\Comment

save() public method

Save (create new/update) comment (with commenter)
public save ( Comment $comment, array $attributes, $userId = null ) : Comment
$comment Newscoop\Entity\Comment
$attributes array
return Newscoop\Entity\Comment

searchByPhrase() public method

Searchs comments by given phrase
public searchByPhrase ( string $phrase ) : Doctrine\ORM\QueryBuilder
$phrase string Phrase
return Doctrine\ORM\QueryBuilder

update() public method

Receives notifications of points events.
public update ( GenericEvent $event ) : void
$event Newscoop\EventDispatcher\Events\GenericEvent
return void

updateComment() public method

Update comment
public updateComment ( Comment $comment, array $attributes ) : Comment
$comment Newscoop\Entity\Comment
$attributes array
return Newscoop\Entity\Comment

Property Details

$em protected property

protected EntityManager,Doctrine\ORM $em
return Doctrine\ORM\EntityManager