Returns all job items attached to this job.
array $conditions: Additional conditions.
\Drupal\tmgmt\JobItemInterface[] An array of translation job items.
Overrides JobInterface::getItems
public function getItems($conditions = array()) {
$items = [];
$query = \Drupal::entityQuery('tmgmt_job_item')
->accessCheck(TRUE)
->condition('tjid', $this
->id());
foreach ($conditions as $key => $condition) {
if (is_array($condition)) {
$operator = isset($condition['operator']) ? $condition['operator'] : '=';
$query
->condition($key, $condition['value'], $operator);
}
else {
$query
->condition($key, $condition);
}
}
$query
->sort('tjiid', 'ASC');
$results = $query
->execute();
if (!empty($results)) {
$items = \Drupal::entityTypeManager()
->getStorage('tmgmt_job_item')
->loadMultiple($results);
if ($this->filterTranslatedItems) {
$items = array_filter($items, function (JobItemInterface $item) {
return $item
->getCountPending() > 0;
});
}
}
return $items;
}