public function Job::getMostRecentItem in Translation Management Tool 8
Returns most recent job item attached to this job.
Parameters
string $plugin: The plugin name.
string $item_type: Source item type.
string $item_id: Source item ID.
Return value
\Drupal\tmgmt\JobItemInterface|null The most recent job item that matches that source or NULL if none exists.
Overrides JobInterface::getMostRecentItem
File
- src/
Entity/ Job.php, line 416
Class
- Job
- Entity class for the tmgmt_job entity.
Namespace
Drupal\tmgmt\EntityCode
public function getMostRecentItem($plugin, $item_type, $item_id) {
$query = \Drupal::entityQuery('tmgmt_job_item')
->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;
}