2011-12-05 12:12:15 +00:00
|
|
|
<?php
|
|
|
|
|
2012-05-03 05:49:41 +00:00
|
|
|
namespace Drupal\comment;
|
2011-12-05 12:12:15 +00:00
|
|
|
|
Issue #597236 by Berdir, catch, msonnabaum, Xano, Wim Leers, jhedstrom, amateescu, corvus_ch, swentel, moshe weitzman, Gábor Hojtsy, riccardoR, killes@www.drop.org, et al: Add entity caching to core.
2014-07-18 10:53:52 +00:00
|
|
|
use Drupal\Core\Cache\CacheBackendInterface;
|
Issue #1596472 by catch, amateescu, claudiu.cristea, Berdir, Mile23, Sam152, pounard, fago, alexpott, fubhy, hchonov: Replace hard coded static cache of entities with cache backends
2018-05-31 10:07:30 +00:00
|
|
|
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
|
2014-03-25 18:41:33 +00:00
|
|
|
use Drupal\Core\Database\Connection;
|
2022-02-10 00:08:44 +00:00
|
|
|
use Drupal\Core\Database\Query\PagerSelectExtender;
|
2019-02-26 15:05:23 +00:00
|
|
|
use Drupal\Core\Entity\EntityFieldManagerInterface;
|
|
|
|
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
2014-03-25 18:41:33 +00:00
|
|
|
use Drupal\Core\Entity\EntityTypeInterface;
|
2014-10-01 14:11:14 +00:00
|
|
|
use Drupal\Core\Entity\EntityInterface;
|
2019-02-26 15:05:23 +00:00
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
2014-10-01 14:11:14 +00:00
|
|
|
use Drupal\Core\Entity\FieldableEntityInterface;
|
2014-09-08 12:12:45 +00:00
|
|
|
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
2014-07-08 22:30:11 +00:00
|
|
|
use Drupal\Core\Session\AccountInterface;
|
2015-01-11 22:25:46 +00:00
|
|
|
use Drupal\Core\Language\LanguageManagerInterface;
|
2014-03-25 18:41:33 +00:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
2011-12-05 12:12:15 +00:00
|
|
|
|
|
|
|
/**
|
2016-03-08 23:33:30 +00:00
|
|
|
* Defines the storage handler class for comments.
|
2011-12-05 12:12:15 +00:00
|
|
|
*
|
2014-09-08 12:12:45 +00:00
|
|
|
* This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class,
|
2014-03-27 11:54:40 +00:00
|
|
|
* adding required special handling for comment entities.
|
2011-12-05 12:12:15 +00:00
|
|
|
*/
|
2014-09-08 12:12:45 +00:00
|
|
|
class CommentStorage extends SqlContentEntityStorage implements CommentStorageInterface {
|
2013-06-16 09:40:11 +00:00
|
|
|
|
2014-07-08 22:30:11 +00:00
|
|
|
/**
|
|
|
|
* The current user.
|
|
|
|
*
|
|
|
|
* @var \Drupal\Core\Session\AccountInterface
|
|
|
|
*/
|
|
|
|
protected $currentUser;
|
|
|
|
|
2014-03-25 18:41:33 +00:00
|
|
|
/**
|
2014-03-27 11:54:40 +00:00
|
|
|
* Constructs a CommentStorage object.
|
2014-03-25 18:41:33 +00:00
|
|
|
*
|
|
|
|
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_info
|
|
|
|
* An array of entity info for the entity type.
|
|
|
|
* @param \Drupal\Core\Database\Connection $database
|
|
|
|
* The database connection to be used.
|
2019-02-26 15:05:23 +00:00
|
|
|
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
|
|
|
|
* The entity field manager.
|
2014-07-08 22:30:11 +00:00
|
|
|
* @param \Drupal\Core\Session\AccountInterface $current_user
|
|
|
|
* The current user.
|
2015-11-02 16:44:53 +00:00
|
|
|
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
|
|
|
|
* Cache backend instance to use.
|
2015-01-11 22:25:46 +00:00
|
|
|
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
|
|
|
* The language manager.
|
Issue #1596472 by catch, amateescu, claudiu.cristea, Berdir, Mile23, Sam152, pounard, fago, alexpott, fubhy, hchonov: Replace hard coded static cache of entities with cache backends
2018-05-31 10:07:30 +00:00
|
|
|
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
|
2019-11-06 09:47:11 +00:00
|
|
|
* The memory cache.
|
2019-02-26 15:05:23 +00:00
|
|
|
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
|
|
|
|
* The entity type bundle info.
|
|
|
|
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
|
|
|
|
* The entity type manager.
|
2014-03-25 18:41:33 +00:00
|
|
|
*/
|
2020-02-26 08:25:29 +00:00
|
|
|
public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityFieldManagerInterface $entity_field_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager) {
|
2019-11-06 09:47:11 +00:00
|
|
|
parent::__construct($entity_info, $database, $entity_field_manager, $cache, $language_manager, $memory_cache, $entity_type_bundle_info, $entity_type_manager);
|
2014-07-08 22:30:11 +00:00
|
|
|
$this->currentUser = $current_user;
|
2014-03-25 18:41:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) {
|
|
|
|
return new static(
|
|
|
|
$entity_info,
|
|
|
|
$container->get('database'),
|
2019-02-26 15:05:23 +00:00
|
|
|
$container->get('entity_field.manager'),
|
Issue #597236 by Berdir, catch, msonnabaum, Xano, Wim Leers, jhedstrom, amateescu, corvus_ch, swentel, moshe weitzman, Gábor Hojtsy, riccardoR, killes@www.drop.org, et al: Add entity caching to core.
2014-07-18 10:53:52 +00:00
|
|
|
$container->get('current_user'),
|
2015-01-11 22:25:46 +00:00
|
|
|
$container->get('cache.entity'),
|
Issue #1596472 by catch, amateescu, claudiu.cristea, Berdir, Mile23, Sam152, pounard, fago, alexpott, fubhy, hchonov: Replace hard coded static cache of entities with cache backends
2018-05-31 10:07:30 +00:00
|
|
|
$container->get('language_manager'),
|
2019-02-26 15:05:23 +00:00
|
|
|
$container->get('entity.memory_cache'),
|
|
|
|
$container->get('entity_type.bundle.info'),
|
2019-11-06 09:47:11 +00:00
|
|
|
$container->get('entity_type.manager')
|
2014-03-25 18:41:33 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-06-16 09:40:11 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2014-07-09 08:08:35 +00:00
|
|
|
public function getMaxThread(CommentInterface $comment) {
|
2018-08-22 12:42:17 +00:00
|
|
|
$query = $this->database->select($this->getDataTable(), 'c')
|
2014-02-16 07:20:53 +00:00
|
|
|
->condition('entity_id', $comment->getCommentedEntityId())
|
2014-06-13 09:34:04 +00:00
|
|
|
->condition('field_name', $comment->getFieldName())
|
2014-07-11 10:37:14 +00:00
|
|
|
->condition('entity_type', $comment->getCommentedEntityTypeId())
|
|
|
|
->condition('default_langcode', 1);
|
2021-01-05 15:02:37 +00:00
|
|
|
$query->addExpression('MAX([thread])', 'thread');
|
2013-09-27 15:34:47 +00:00
|
|
|
return $query->execute()
|
|
|
|
->fetchField();
|
2013-06-16 09:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2014-07-09 08:08:35 +00:00
|
|
|
public function getMaxThreadPerThread(CommentInterface $comment) {
|
2018-08-22 12:42:17 +00:00
|
|
|
$query = $this->database->select($this->getDataTable(), 'c')
|
2014-02-16 07:20:53 +00:00
|
|
|
->condition('entity_id', $comment->getCommentedEntityId())
|
2014-06-13 09:34:04 +00:00
|
|
|
->condition('field_name', $comment->getFieldName())
|
2014-02-16 07:20:53 +00:00
|
|
|
->condition('entity_type', $comment->getCommentedEntityTypeId())
|
2014-07-11 10:37:14 +00:00
|
|
|
->condition('thread', $comment->getParentComment()->getThread() . '.%', 'LIKE')
|
|
|
|
->condition('default_langcode', 1);
|
2021-01-05 15:02:37 +00:00
|
|
|
$query->addExpression('MAX([thread])', 'thread');
|
2013-09-27 15:34:47 +00:00
|
|
|
return $query->execute()
|
|
|
|
->fetchField();
|
2013-06-16 09:40:11 +00:00
|
|
|
}
|
|
|
|
|
2014-07-08 22:30:11 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $divisor = 1) {
|
|
|
|
// Count how many comments (c1) are before $comment (c2) in display order.
|
|
|
|
// This is the 0-based display ordinal.
|
2018-08-22 12:42:17 +00:00
|
|
|
$data_table = $this->getDataTable();
|
|
|
|
$query = $this->database->select($data_table, 'c1');
|
2021-01-05 15:02:37 +00:00
|
|
|
$query->innerJoin($data_table, 'c2', '[c2].[entity_id] = [c1].[entity_id] AND [c2].[entity_type] = [c1].[entity_type] AND [c2].[field_name] = [c1].[field_name]');
|
2014-07-08 22:30:11 +00:00
|
|
|
$query->addExpression('COUNT(*)', 'count');
|
|
|
|
$query->condition('c2.cid', $comment->id());
|
|
|
|
if (!$this->currentUser->hasPermission('administer comments')) {
|
|
|
|
$query->condition('c1.status', CommentInterface::PUBLISHED);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($comment_mode == CommentManagerInterface::COMMENT_MODE_FLAT) {
|
|
|
|
// For rendering flat comments, cid is used for ordering comments due to
|
|
|
|
// unpredictable behavior with timestamp, so we make the same assumption
|
|
|
|
// here.
|
|
|
|
$query->condition('c1.cid', $comment->id(), '<');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// For threaded comments, the c.thread column is used for ordering. We can
|
|
|
|
// use the sorting code for comparison, but must remove the trailing
|
|
|
|
// slash.
|
2021-01-05 15:02:37 +00:00
|
|
|
$query->where('SUBSTRING([c1].[thread], 1, (LENGTH([c1].[thread]) - 1)) < SUBSTRING([c2].[thread], 1, (LENGTH([c2].[thread]) - 1))');
|
2014-07-08 22:30:11 +00:00
|
|
|
}
|
|
|
|
|
2014-07-11 10:37:14 +00:00
|
|
|
$query->condition('c1.default_langcode', 1);
|
|
|
|
$query->condition('c2.default_langcode', 1);
|
|
|
|
|
2014-07-08 22:30:11 +00:00
|
|
|
$ordinal = $query->execute()->fetchField();
|
|
|
|
|
|
|
|
return ($divisor > 1) ? floor($ordinal / $divisor) : $ordinal;
|
|
|
|
}
|
|
|
|
|
2014-07-09 08:08:35 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2015-10-19 23:25:24 +00:00
|
|
|
public function getNewCommentPageNumber($total_comments, $new_comments, FieldableEntityInterface $entity, $field_name) {
|
2014-09-20 02:45:52 +00:00
|
|
|
$field = $entity->getFieldDefinition($field_name);
|
|
|
|
$comments_per_page = $field->getSetting('per_page');
|
2018-08-22 12:42:17 +00:00
|
|
|
$data_table = $this->getDataTable();
|
2014-07-09 08:08:35 +00:00
|
|
|
|
|
|
|
if ($total_comments <= $comments_per_page) {
|
|
|
|
// Only one page of comments.
|
|
|
|
$count = 0;
|
|
|
|
}
|
2014-09-20 02:45:52 +00:00
|
|
|
elseif ($field->getSetting('default_mode') == CommentManagerInterface::COMMENT_MODE_FLAT) {
|
2014-07-09 08:08:35 +00:00
|
|
|
// Flat comments.
|
|
|
|
$count = $total_comments - $new_comments;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Threaded comments.
|
|
|
|
|
|
|
|
// 1. Find all the threads with a new comment.
|
2018-08-22 12:42:17 +00:00
|
|
|
$unread_threads_query = $this->database->select($data_table, 'comment')
|
2017-03-04 01:20:24 +00:00
|
|
|
->fields('comment', ['thread'])
|
2014-07-09 08:08:35 +00:00
|
|
|
->condition('entity_id', $entity->id())
|
|
|
|
->condition('entity_type', $entity->getEntityTypeId())
|
|
|
|
->condition('field_name', $field_name)
|
|
|
|
->condition('status', CommentInterface::PUBLISHED)
|
2014-07-11 10:37:14 +00:00
|
|
|
->condition('default_langcode', 1)
|
2014-07-09 08:08:35 +00:00
|
|
|
->orderBy('created', 'DESC')
|
|
|
|
->orderBy('cid', 'DESC')
|
|
|
|
->range(0, $new_comments);
|
|
|
|
|
|
|
|
// 2. Find the first thread.
|
|
|
|
$first_thread_query = $this->database->select($unread_threads_query, 'thread');
|
2021-01-05 15:02:37 +00:00
|
|
|
$first_thread_query->addExpression('SUBSTRING([thread], 1, (LENGTH([thread]) - 1))', 'torder');
|
2014-07-09 08:08:35 +00:00
|
|
|
$first_thread = $first_thread_query
|
2017-03-04 01:20:24 +00:00
|
|
|
->fields('thread', ['thread'])
|
2014-07-09 08:08:35 +00:00
|
|
|
->orderBy('torder')
|
|
|
|
->range(0, 1)
|
|
|
|
->execute()
|
|
|
|
->fetchField();
|
|
|
|
|
|
|
|
// Remove the final '/'.
|
|
|
|
$first_thread = substr($first_thread, 0, -1);
|
|
|
|
|
|
|
|
// Find the number of the first comment of the first unread thread.
|
2021-01-05 15:02:37 +00:00
|
|
|
$count = $this->database->query('SELECT COUNT(*) FROM {' . $data_table . '} WHERE [entity_id] = :entity_id
|
|
|
|
AND [entity_type] = :entity_type
|
|
|
|
AND [field_name] = :field_name
|
|
|
|
AND [status] = :status
|
|
|
|
AND SUBSTRING([thread], 1, (LENGTH([thread]) - 1)) < :thread
|
|
|
|
AND [default_langcode] = 1', [
|
2014-07-09 08:08:35 +00:00
|
|
|
':status' => CommentInterface::PUBLISHED,
|
|
|
|
':entity_id' => $entity->id(),
|
|
|
|
':field_name' => $field_name,
|
|
|
|
':entity_type' => $entity->getEntityTypeId(),
|
|
|
|
':thread' => $first_thread,
|
2017-03-04 01:20:24 +00:00
|
|
|
])->fetchField();
|
2014-07-09 08:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $comments_per_page > 0 ? (int) ($count / $comments_per_page) : 0;
|
|
|
|
}
|
|
|
|
|
2013-06-16 09:40:11 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getChildCids(array $comments) {
|
2018-08-22 12:42:17 +00:00
|
|
|
return $this->database->select($this->getDataTable(), 'c')
|
2017-03-04 01:20:24 +00:00
|
|
|
->fields('c', ['cid'])
|
2015-02-03 09:42:28 +00:00
|
|
|
->condition('pid', array_keys($comments), 'IN')
|
2014-07-11 10:37:14 +00:00
|
|
|
->condition('default_langcode', 1)
|
2013-06-16 09:40:11 +00:00
|
|
|
->execute()
|
|
|
|
->fetchCol();
|
|
|
|
}
|
2013-12-22 21:11:36 +00:00
|
|
|
|
2014-07-18 22:30:49 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
|
|
|
* To display threaded comments in the correct order we keep a 'thread' field
|
|
|
|
* and order by that value. This field keeps this data in
|
|
|
|
* a way which is easy to update and convenient to use.
|
|
|
|
*
|
|
|
|
* A "thread" value starts at "1". If we add a child (A) to this comment,
|
|
|
|
* we assign it a "thread" = "1.1". A child of (A) will have "1.1.1". Next
|
|
|
|
* brother of (A) will get "1.2". Next brother of the parent of (A) will get
|
|
|
|
* "2" and so on.
|
|
|
|
*
|
|
|
|
* First of all note that the thread field stores the depth of the comment:
|
|
|
|
* depth 0 will be "X", depth 1 "X.X", depth 2 "X.X.X", etc.
|
|
|
|
*
|
|
|
|
* Now to get the ordering right, consider this example:
|
|
|
|
*
|
|
|
|
* 1
|
|
|
|
* 1.1
|
|
|
|
* 1.1.1
|
|
|
|
* 1.2
|
|
|
|
* 2
|
|
|
|
*
|
|
|
|
* If we "ORDER BY thread ASC" we get the above result, and this is the
|
|
|
|
* natural order sorted by time. However, if we "ORDER BY thread DESC"
|
|
|
|
* we get:
|
|
|
|
*
|
|
|
|
* 2
|
|
|
|
* 1.2
|
|
|
|
* 1.1.1
|
|
|
|
* 1.1
|
|
|
|
* 1
|
|
|
|
*
|
|
|
|
* Clearly, this is not a natural way to see a thread, and users will get
|
|
|
|
* confused. The natural order to show a thread by time desc would be:
|
|
|
|
*
|
|
|
|
* 2
|
|
|
|
* 1
|
|
|
|
* 1.2
|
|
|
|
* 1.1
|
|
|
|
* 1.1.1
|
|
|
|
*
|
|
|
|
* which is what we already did before the standard pager patch. To achieve
|
|
|
|
* this we simply add a "/" at the end of each "thread" value. This way, the
|
|
|
|
* thread fields will look like this:
|
|
|
|
*
|
|
|
|
* 1/
|
|
|
|
* 1.1/
|
|
|
|
* 1.1.1/
|
|
|
|
* 1.2/
|
|
|
|
* 2/
|
|
|
|
*
|
|
|
|
* we add "/" since this char is, in ASCII, higher than every number, so if
|
|
|
|
* now we "ORDER BY thread DESC" we get the correct order. However this would
|
|
|
|
* spoil the reverse ordering, "ORDER BY thread ASC" -- here, we do not need
|
|
|
|
* to consider the trailing "/" so we use a substring only.
|
|
|
|
*/
|
|
|
|
public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0) {
|
2018-08-22 12:42:17 +00:00
|
|
|
$data_table = $this->getDataTable();
|
|
|
|
$query = $this->database->select($data_table, 'c');
|
2014-07-18 22:30:49 +00:00
|
|
|
$query->addField('c', 'cid');
|
|
|
|
$query
|
|
|
|
->condition('c.entity_id', $entity->id())
|
|
|
|
->condition('c.entity_type', $entity->getEntityTypeId())
|
|
|
|
->condition('c.field_name', $field_name)
|
|
|
|
->condition('c.default_langcode', 1)
|
|
|
|
->addTag('entity_access')
|
|
|
|
->addTag('comment_filter')
|
|
|
|
->addMetaData('base_table', 'comment')
|
|
|
|
->addMetaData('entity', $entity)
|
|
|
|
->addMetaData('field_name', $field_name);
|
|
|
|
|
2015-02-21 14:31:45 +00:00
|
|
|
if ($comments_per_page) {
|
2022-02-10 00:08:44 +00:00
|
|
|
$query = $query->extend(PagerSelectExtender::class)
|
2015-02-21 14:31:45 +00:00
|
|
|
->limit($comments_per_page);
|
|
|
|
if ($pager_id) {
|
|
|
|
$query->element($pager_id);
|
|
|
|
}
|
|
|
|
|
2018-08-22 12:42:17 +00:00
|
|
|
$count_query = $this->database->select($data_table, 'c');
|
2015-02-21 14:31:45 +00:00
|
|
|
$count_query->addExpression('COUNT(*)');
|
|
|
|
$count_query
|
|
|
|
->condition('c.entity_id', $entity->id())
|
|
|
|
->condition('c.entity_type', $entity->getEntityTypeId())
|
|
|
|
->condition('c.field_name', $field_name)
|
|
|
|
->condition('c.default_langcode', 1)
|
|
|
|
->addTag('entity_access')
|
|
|
|
->addTag('comment_filter')
|
|
|
|
->addMetaData('base_table', 'comment')
|
|
|
|
->addMetaData('entity', $entity)
|
|
|
|
->addMetaData('field_name', $field_name);
|
|
|
|
$query->setCountQuery($count_query);
|
|
|
|
}
|
2014-07-18 22:30:49 +00:00
|
|
|
|
|
|
|
if (!$this->currentUser->hasPermission('administer comments')) {
|
|
|
|
$query->condition('c.status', CommentInterface::PUBLISHED);
|
2015-02-21 14:31:45 +00:00
|
|
|
if ($comments_per_page) {
|
|
|
|
$count_query->condition('c.status', CommentInterface::PUBLISHED);
|
|
|
|
}
|
2014-07-18 22:30:49 +00:00
|
|
|
}
|
|
|
|
if ($mode == CommentManagerInterface::COMMENT_MODE_FLAT) {
|
|
|
|
$query->orderBy('c.cid', 'ASC');
|
|
|
|
}
|
|
|
|
else {
|
2022-01-01 16:19:49 +00:00
|
|
|
// See comment above. Analysis reveals that this doesn't cost too much. It
|
|
|
|
// scales much better than having the whole comment structure.
|
2021-01-05 15:02:37 +00:00
|
|
|
$query->addExpression('SUBSTRING([c].[thread], 1, (LENGTH([c].[thread]) - 1))', 'torder');
|
2014-07-18 22:30:49 +00:00
|
|
|
$query->orderBy('torder', 'ASC');
|
|
|
|
}
|
|
|
|
|
|
|
|
$cids = $query->execute()->fetchCol();
|
|
|
|
|
2017-03-04 01:20:24 +00:00
|
|
|
$comments = [];
|
2014-07-18 22:30:49 +00:00
|
|
|
if ($cids) {
|
|
|
|
$comments = $this->loadMultiple($cids);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $comments;
|
|
|
|
}
|
|
|
|
|
2014-06-26 18:57:22 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getUnapprovedCount() {
|
2018-08-22 12:42:17 +00:00
|
|
|
return $this->database->select($this->getDataTable(), 'c')
|
2014-06-26 18:57:22 +00:00
|
|
|
->condition('status', CommentInterface::NOT_PUBLISHED, '=')
|
2014-07-11 10:37:14 +00:00
|
|
|
->condition('default_langcode', 1)
|
2014-06-26 18:57:22 +00:00
|
|
|
->countQuery()
|
|
|
|
->execute()
|
|
|
|
->fetchField();
|
|
|
|
}
|
|
|
|
|
2011-12-05 12:12:15 +00:00
|
|
|
}
|