summaryrefslogtreecommitdiffstats
path: root/core/modules/comment/comment.module
diff options
context:
space:
mode:
authorNathaniel Catchpole2014-05-20 09:29:40 (GMT)
committerNathaniel Catchpole2014-05-20 09:29:40 (GMT)
commitc972b3ee9d6ef7d1554480ea95d0bcc623d01c77 (patch)
treecd99a0eb05894994a5612d59067cce0b3d7f361c /core/modules/comment/comment.module
parent21fbb5ddaffc925ed58f8086d0bf90e44845d4b3 (diff)
Issue #2190313 by pfrenssen, Berdir, amateescu, ianthomas_uk: Add $EntityType::load() and loadMultiple() to simplify loading entities.
Diffstat (limited to 'core/modules/comment/comment.module')
-rw-r--r--core/modules/comment/comment.module18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 18f0a57..faaf6b6 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -11,6 +11,7 @@
*/
use Drupal\comment\CommentInterface;
+use Drupal\comment\Entity\Comment;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\entity\Entity\EntityViewDisplay;
@@ -1049,8 +1050,8 @@ function comment_user_predelete($account) {
/**
* Loads comment entities from the database.
*
- * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
- * Use entity_load_multiple('comment', $cids).
+ * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
+ * Use \Drupal\comment\Entity\Comment::loadMultiple().
*
* @param array $cids
* (optional) An array of entity IDs. If omitted, all entities are loaded.
@@ -1064,7 +1065,10 @@ function comment_user_predelete($account) {
* @see \Drupal\Core\Entity\Query\QueryInterface
*/
function comment_load_multiple(array $cids = NULL, $reset = FALSE) {
- return entity_load_multiple('comment', $cids, $reset);
+ if ($reset) {
+ \Drupal::entityManager()->getStorage('comment')->resetCache($cids);
+ }
+ return Comment::loadMultiple($cids);
}
/**
@@ -1077,9 +1081,15 @@ function comment_load_multiple(array $cids = NULL, $reset = FALSE) {
*
* @return \Drupal\comment\CommentInterface
* The comment object.
+ *
+ * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
+ * Use \Drupal\comment\Entity\Comment::load().
*/
function comment_load($cid, $reset = FALSE) {
- return entity_load('comment', $cid, $reset);
+ if ($reset) {
+ \Drupal::entityManager()->getStorage('comment')->resetCache(array($cid));
+ }
+ return Comment::load($cid);
}
/**