Returns most recent job item attached to this job.
string $plugin: The plugin name.
string $item_type: Source item type.
string $item_id: Source item ID.
\Drupal\tmgmt\JobItemInterface|null The most recent job item that matches that source or NULL if none exists.
Overrides JobInterface::getMostRecentItem
public function getMostRecentItem($plugin, $item_type, $item_id) {
$query = \Drupal::entityQuery('tmgmt_job_item')
->accessCheck(TRUE)
->condition('tjid', $this
->id())
->condition('plugin', $plugin)
->condition('item_type', $item_type)
->condition('item_id', $item_id)
->sort('tjiid', 'DESC')
->range(0, 1);
$result = $query
->execute();
if (!empty($result)) {
return JobItem::load(reset($result));
}
return NULL;
}