SchedulerManager queryentity can not use filter by moderation state

Created on 27 December 2019, almost 5 years ago
Updated 7 June 2024, 6 months ago

Hi team,
I use scheduler and workflow to auto publish content,
I want when the moderation state is auto_push ,then the scheduler can be publish .
so I think i can changed the source code for it.

In docroot/modules/contrib/scheduler/src/SchedulerManager.php:
the Original code :
$query = \Drupal::entityQuery('node')
->exists('publish_on')
->condition('publish_on', REQUEST_TIME, '<=')
->condition('type', $scheduler_enabled_types, 'IN')
->latestRevision()
->sort('publish_on')
->sort('nid');
// Disable access checks for this query.
// @see https://www.drupal.org/node/2700209 →
$query->accessCheck(FALSE);
$nids = $query->execute();

this is my code :

$query = \Drupal::entityQuery('node')
->exists('publish_on')
->condition('publish_on', REQUEST_TIME, '<=')
->condition('type', $scheduler_enabled_types, 'IN')
->condition('moderation_state','auto_publish', '=')
->latestRevision()
->sort('publish_on')
->sort('nid');
// Disable access checks for this query.
// @see https://www.drupal.org/node/2700209 →
$query->accessCheck(FALSE);
$nids = $query->execute();
But it have a error .
error message:
Drupal\Core\Entity\Query\QueryException: 'moderation_state' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 415 of docroot\core\lib\Drupal\Core\Entity\Query\Sql\Tables.php)..

The i search google find same question.
https://www.drupal.org/project/drupal/issues/3025164#comment-13221005 →

so how can i resolved it ?

Can you help me?

Thanks

💬 Support request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024