Drupal 8  8.0.2
CommentStatistics Class Reference
Inheritance diagram for CommentStatistics:

Public Member Functions

 __construct (Connection $database, AccountInterface $current_user, EntityManagerInterface $entity_manager, StateInterface $state)
 
 read ($entities, $entity_type, $accurate=TRUE)
 
 delete (EntityInterface $entity)
 
 create (FieldableEntityInterface $entity, $fields)
 
 getMaximumCount ($entity_type)
 
 getRankingInfo ()
 
 update (CommentInterface $comment)
 

Protected Attributes

 $database
 
 $currentUser
 
 $entityManager
 
 $state
 

Constructor & Destructor Documentation

__construct ( Connection  $database,
AccountInterface  $current_user,
EntityManagerInterface  $entity_manager,
StateInterface  $state 
)

Constructs the CommentStatistics service.

Parameters
\Drupal\Core\Database\Connection$databaseThe active database connection.
\Drupal\Core\Session\AccountInterface$current_userThe current logged in user.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager service.
\Drupal\Core\State\StateInterface$stateThe state service.

References Drupal\currentUser(), Drupal\database(), Drupal\entityManager(), and Drupal\state().

Here is the call graph for this function:

Member Function Documentation

create ( FieldableEntityInterface  $entity,
  $fields 
)

{Insert an empty record for the given entity.

Parameters
\Drupal\Core\Entity\FieldableEntityInterface$entityThe created entity for which a statistics record is to be initialized.
array$fieldsArray of comment field definitions for the given entity.
}

Implements CommentStatisticsInterface.

References Drupal\currentUser(), and Drupal\database().

Here is the call graph for this function:

delete ( EntityInterface  $entity)

{Delete comment statistics records for an entity.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity for which comment statistics should be deleted.
}

Implements CommentStatisticsInterface.

References Drupal\database().

Here is the call graph for this function:

getMaximumCount (   $entity_type)

{Find the maximum number of comments for the given entity type.Used to influence search rankings.

Parameters
string$entity_typeThe entity type to consider when fetching the maximum comment count for.
Returns
int The maximum number of comments for and entity of the given type.
See Also
comment_update_index()
}

Implements CommentStatisticsInterface.

References Drupal\database().

Here is the call graph for this function:

getRankingInfo ( )

{Returns an array of ranking information for hook_ranking().

Returns
array Array of ranking information as expected by hook_ranking().
See Also
hook_ranking()
comment_ranking()
}

Implements CommentStatisticsInterface.

References Drupal\state(), and t().

Here is the call graph for this function:

read (   $entities,
  $entity_type,
  $accurate = TRUE 
)

{Read comment statistics records for an array of entities.

Parameters
\Drupal\Core\Entity\EntityInterface[]$entities Array of entities on which commenting is enabled, keyed by id
string$entity_typeThe entity type of the passed entities.
bool$accurate(optional) Indicates if results must be completely up to date. If set to FALSE, a replica database will used if available. Defaults to TRUE.
Returns
object[] Array of statistics records.
}

Implements CommentStatisticsInterface.

References Drupal\database().

Here is the call graph for this function:

update ( CommentInterface  $comment)

{Update or insert comment statistics records after a comment is added.

Parameters
\Drupal\comment\CommentInterface$commentThe comment added or updated.
}

Implements CommentStatisticsInterface.

References Drupal\currentUser(), Drupal\database(), Drupal\entityManager(), CommentInterface\getCommentedEntity(), CommentInterface\getCommentedEntityId(), CommentInterface\getCommentedEntityTypeId(), CommentInterface\getFieldName(), CommentInterface\PUBLISHED, and Drupal\state().

Here is the call graph for this function:


The documentation for this class was generated from the following file: