public function Migrator::query in Lightning Workflow 8.2
Same name and namespace in other branches
- 8.3 modules/lightning_scheduler/src/Migrator.php \Drupal\lightning_scheduler\Migrator::query()
Queries for all entities of a specific type which need to be migrated.
Parameters
string $entity_type_id: The entity type ID.
Return value
\Drupal\Core\Entity\Query\QueryInterface The prepared query.
File
- modules/
lightning_scheduler/ src/ Migrator.php, line 132
Class
- Migrator
- This class is final because the migration is not an API and should not be extended or re-used.
Namespace
Drupal\lightning_schedulerCode
public function query($entity_type_id) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
$fields = [
$entity_type
->getKey('id'),
'scheduled_publication',
'scheduled_moderation_state',
];
if ($entity_type
->isRevisionable()) {
array_push($fields, $entity_type
->getKey('revision'));
}
if ($entity_type
->isTranslatable()) {
array_push($fields, $entity_type
->getKey('langcode'));
}
$table = $entity_type
->getRevisionDataTable() ?: $entity_type
->getDataTable();
return $this->database
->select($table)
->fields($table, $fields)
->isNotNull('scheduled_publication')
->isNotNull('scheduled_moderation_state');
}