|
|
|
|
@ -546,12 +546,13 @@ class Manager implements ICommentsManager {
|
|
|
|
|
* @param $objectId string the id of the object
|
|
|
|
|
* @param \DateTime $notOlderThan optional, timestamp of the oldest comments
|
|
|
|
|
* that may be returned
|
|
|
|
|
* @param string $verb Limit the verb of the comment - Added in 14.0.0
|
|
|
|
|
* @return Int
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null) {
|
|
|
|
|
public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') {
|
|
|
|
|
$qb = $this->dbConn->getQueryBuilder();
|
|
|
|
|
$query = $qb->select($qb->createFunction('COUNT(`id`)'))
|
|
|
|
|
$query = $qb->select($qb->createFunction('COUNT(' . $qb->getColumnName('id') . ')'))
|
|
|
|
|
->from('comments')
|
|
|
|
|
->where($qb->expr()->eq('object_type', $qb->createParameter('type')))
|
|
|
|
|
->andWhere($qb->expr()->eq('object_id', $qb->createParameter('id')))
|
|
|
|
|
@ -564,6 +565,10 @@ class Manager implements ICommentsManager {
|
|
|
|
|
->setParameter('notOlderThan', $notOlderThan, 'datetime');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($verb !== '') {
|
|
|
|
|
$query->andWhere($qb->expr()->eq('verb', $qb->createNamedParameter($verb)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$resultStatement = $query->execute();
|
|
|
|
|
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
|
|
|
|
|
$resultStatement->closeCursor();
|
|
|
|
|
|