You are here

public function Job::getMessages in Translation Management Tool 8

Returns all job messages attached to this job.

Parameters

array $conditions: Additional conditions.

Return value

\Drupal\tmgmt\MessageInterface[] An array of translation job messages.

Overrides JobInterface::getMessages

1 call to Job::getMessages()
Job::getMessagesSince in src/Entity/Job.php
Returns all job messages attached to this job.

File

src/Entity/Job.php, line 434

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getMessages($conditions = array()) {
  $query = \Drupal::entityQuery('tmgmt_message')
    ->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('created', 'ASC');
  $query
    ->sort('mid', 'ASC');
  $results = $query
    ->execute();
  if (!empty($results)) {
    return Message::loadMultiple($results);
  }
  return array();
}