Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
627470bc
Commit
627470bc
authored
Jun 24, 2014
by
webchick
Browse files
Issue
#2291445
by marcingy: Convert comment_entity_predelete query to entity query.
parent
5baeab76
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/comment/comment.module
View file @
627470bc
...
...
@@ -839,12 +839,10 @@ function comment_entity_predelete(EntityInterface $entity) {
// entity type that has an integer ID, $entity->id() might be a string
// containing a number), and then cast it to an integer when querying.
if
(
$entity
->
getEntityType
()
->
isFieldable
()
&&
is_numeric
(
$entity
->
id
()))
{
$cids
=
db_select
(
'comment'
,
'c'
)
->
fields
(
'c'
,
array
(
'cid'
))
->
condition
(
'entity_id'
,
(
int
)
$entity
->
id
())
->
condition
(
'entity_type'
,
$entity
->
getEntityTypeId
())
->
execute
()
->
fetchCol
();
$entity_query
=
\
Drupal
::
entityQuery
(
'comment'
);
$entity_query
->
condition
(
'entity_id'
,
(
int
)
$entity
->
id
());
$entity_query
->
condition
(
'entity_type'
,
$entity
->
getEntityTypeId
());
$cids
=
$entity_query
->
execute
();
entity_delete_multiple
(
'comment'
,
$cids
);
\
Drupal
::
service
(
'comment.statistics'
)
->
delete
(
$entity
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment