PHP Class Newscoop\Entity\Repository\CommentRepository

Inheritance: extends Newscoop\Datatable\Source, implements Newscoop\Search\RepositoryInterface
Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Methods

Method Description
countByUser ( User $user ) : integer Get comments count for user
deleteArticle ( Newscoop\Entity\Article $article, Newscoop\Entity\Language $language = null ) Delete article comments
deleteCommenter ( Newscoop\Entity\Commenter $commenter ) Delete commenter comments
deleteCommenters ( array $commenters ) Delete commenter comments
flush ( ) Flush method
getArticleComments ( integer $article, string $language, $recommended = false, $getDeleted = true, $showHidden = true ) : Doctrine\ORM\Query Get comments for article
getBatch ( mixed $count = self::BATCH_COUNT, array $filter = null ) : array Find comments for indexing
getComment ( integer $id, $getDeleted = true ) : Query Get single comment query
getComments ( $getDeleted = true, $showHidden = true ) : Query Get all comments query
getCommentsForAuthorArticlesPerDay ( Author $author, string $range = '-60 days' ) : Doctrine\ORM\Query Get Comments for all authors articles grouped by day
getCount ( array $p_params = null, array $p_cols = [] ) : integer Get entity count
getData ( array $p_params, array $p_cols ) : Comment[] Get data for table
getDirectReplies ( $commentId ) Get direct replies to a comment
getPrototype ( ) : Comment Get new instance of the comment
save ( Comment $entity, array $values ) : Comment Method for saving a comment
setArticleStatus ( integer $p_article, $p_language, string $p_status ) : void Method for setting status per article
setCommentRecommended ( Comment $comment, string $recommended ) : void Method for setting recommended for a comment
setIndexedNow ( array $comments ) : void Set indexed now
setIndexedNull ( array $comments = null ) : void Set indexed null
setRecommended ( array $commentIds, integer $recommended ) : void Method for recommending a comment
setStatus ( array $p_comment_ids, string $p_status ) : void Method for setting status
update ( Comment $comment, array $values ) : Comment Method for update a comment

Protected Methods

Method Description
buildFilter ( array $p_cols, array $p_filter, $qb, $andx ) Build filter condition
buildWhere ( array $p_cols, $p_search, $qb = null, $andx = null ) : Doctrine\ORM\Query\Expr Build where condition

Private Methods

Method Description
setCommentStatus ( Comment $p_comment, string $p_status ) : void Method for setting status for a comment

Method Details

buildFilter() protected method

Build filter condition
protected buildFilter ( array $p_cols, array $p_filter, $qb, $andx )
$p_cols array
$p_filter array

buildWhere() protected method

Build where condition
protected buildWhere ( array $p_cols, $p_search, $qb = null, $andx = null ) : Doctrine\ORM\Query\Expr
$p_cols array
return Doctrine\ORM\Query\Expr

countByUser() public method

Get comments count for user
public countByUser ( User $user ) : integer
$user Newscoop\Entity\User
return integer

deleteArticle() public method

Delete article comments
public deleteArticle ( Newscoop\Entity\Article $article, Newscoop\Entity\Language $language = null )
$article Newscoop\Entity\Article
$language Newscoop\Entity\Language

deleteCommenter() public method

Delete commenter comments
public deleteCommenter ( Newscoop\Entity\Commenter $commenter )
$commenter Newscoop\Entity\Commenter

deleteCommenters() public method

Delete commenter comments
public deleteCommenters ( array $commenters )
$commenters array

flush() public method

Flush method
public flush ( )

getArticleComments() public method

Get comments for article
public getArticleComments ( integer $article, string $language, $recommended = false, $getDeleted = true, $showHidden = true ) : Doctrine\ORM\Query
$article integer Article number
$language string Language code in format "en" for example.
return Doctrine\ORM\Query Query

getBatch() public method

Find comments for indexing
public getBatch ( mixed $count = self::BATCH_COUNT, array $filter = null ) : array
$count mixed Number of comments to index. When null default will be used
$filter array
return array

getComment() public method

Get single comment query
public getComment ( integer $id, $getDeleted = true ) : Query
$id integer
return Query

getComments() public method

Get all comments query
public getComments ( $getDeleted = true, $showHidden = true ) : Query
return Query

getCommentsForAuthorArticlesPerDay() public method

Get Comments for all authors articles grouped by day
public getCommentsForAuthorArticlesPerDay ( Author $author, string $range = '-60 days' ) : Doctrine\ORM\Query
$author Newscoop\Entity\Author
$range string
return Doctrine\ORM\Query

getCount() public method

Get entity count
public getCount ( array $p_params = null, array $p_cols = [] ) : integer
$p_params array
$p_cols array
return integer

getData() public method

Get data for table
public getData ( array $p_params, array $p_cols ) : Comment[]
$p_params array
$p_cols array
return Newscoop\Entity\Comment[]

getDirectReplies() public method

Get direct replies to a comment
public getDirectReplies ( $commentId )
$commentId return array

getPrototype() public method

Get new instance of the comment
public getPrototype ( ) : Comment
return Newscoop\Entity\Comment

save() public method

Method for saving a comment
public save ( Comment $entity, array $values ) : Comment
$entity Newscoop\Entity\Comment
$values array
return Newscoop\Entity\Comment

setArticleStatus() public method

Method for setting status per article
public setArticleStatus ( integer $p_article, $p_language, string $p_status ) : void
$p_article integer
$p_status string
return void

setCommentRecommended() public method

Method for setting recommended for a comment
public setCommentRecommended ( Comment $comment, string $recommended ) : void
$comment Newscoop\Entity\Comment
$recommended string
return void

setIndexedNow() public method

Set indexed now
public setIndexedNow ( array $comments ) : void
$comments array
return void

setIndexedNull() public method

Set indexed null
public setIndexedNull ( array $comments = null ) : void
$comments array
return void

setRecommended() public method

Method for recommending a comment
public setRecommended ( array $commentIds, integer $recommended ) : void
$commentIds array
$recommended integer
return void

setStatus() public method

Method for setting status
public setStatus ( array $p_comment_ids, string $p_status ) : void
$p_comment_ids array
$p_status string
return void

update() public method

Method for update a comment
public update ( Comment $comment, array $values ) : Comment
$comment Newscoop\Entity\Comment
$values array
return Newscoop\Entity\Comment $enitity