Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/src/CommentStatisticsInterface.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\comment; | |
4 | |
5 use Drupal\Core\Entity\FieldableEntityInterface; | |
6 use Drupal\Core\Entity\EntityInterface; | |
7 | |
8 /** | |
9 * Provides an interface for storing and retrieving comment statistics. | |
10 */ | |
11 interface CommentStatisticsInterface { | |
12 | |
13 /** | |
14 * Returns an array of ranking information for hook_ranking(). | |
15 * | |
16 * @return array | |
17 * Array of ranking information as expected by hook_ranking(). | |
18 * | |
19 * @see hook_ranking() | |
20 * @see comment_ranking() | |
21 */ | |
22 public function getRankingInfo(); | |
23 | |
24 /** | |
25 * Read comment statistics records for an array of entities. | |
26 * | |
27 * @param \Drupal\Core\Entity\EntityInterface[] $entities | |
28 * Array of entities on which commenting is enabled, keyed by id | |
29 * @param string $entity_type | |
30 * The entity type of the passed entities. | |
31 * @param bool $accurate | |
32 * (optional) Indicates if results must be completely up to date. If set to | |
33 * FALSE, a replica database will used if available. Defaults to TRUE. | |
34 * | |
35 * @return object[] | |
36 * Array of statistics records. | |
37 */ | |
38 public function read($entities, $entity_type, $accurate = TRUE); | |
39 | |
40 /** | |
41 * Delete comment statistics records for an entity. | |
42 * | |
43 * @param \Drupal\Core\Entity\EntityInterface $entity | |
44 * The entity for which comment statistics should be deleted. | |
45 */ | |
46 public function delete(EntityInterface $entity); | |
47 | |
48 /** | |
49 * Update or insert comment statistics records after a comment is added. | |
50 * | |
51 * @param \Drupal\comment\CommentInterface $comment | |
52 * The comment added or updated. | |
53 */ | |
54 public function update(CommentInterface $comment); | |
55 | |
56 /** | |
57 * Find the maximum number of comments for the given entity type. | |
58 * | |
59 * Used to influence search rankings. | |
60 * | |
61 * @param string $entity_type | |
62 * The entity type to consider when fetching the maximum comment count for. | |
63 * | |
64 * @return int | |
65 * The maximum number of comments for and entity of the given type. | |
66 * | |
67 * @see comment_update_index() | |
68 */ | |
69 public function getMaximumCount($entity_type); | |
70 | |
71 /** | |
72 * Insert an empty record for the given entity. | |
73 * | |
74 * @param \Drupal\Core\Entity\FieldableEntityInterface $entity | |
75 * The created entity for which a statistics record is to be initialized. | |
76 * @param array $fields | |
77 * Array of comment field definitions for the given entity. | |
78 */ | |
79 public function create(FieldableEntityInterface $entity, $fields); | |
80 | |
81 } |