class ShouldCreateJobEvent

Represents a job item about to be added to a continuous job.

Hierarchy

Expanded class hierarchy of ShouldCreateJobEvent

See also

\Drupal\tmgmt\ContinuousSourceInterface::shouldCreateContinuousItem()

2 files declare their use of ShouldCreateJobEvent

File

src/Events/ShouldCreateJobEvent.php, line 13

Namespace

Drupal\tmgmt\Events
View source
class ShouldCreateJobEvent extends Event {

  /**
   *  Continuous job entity.
   *
   * @var \Drupal\tmgmt\JobInterface
   */
  protected $job;

  /**
   * The plugin ID.
   *
   * @var string
   */
  protected $plugin;

  /**
   * The item type.
   *
   * @var string
   */
  protected $itemType;

  /**
   * The source item id.
   *
   * @var string
   */
  protected $itemId;

  /**
   * Whether or not the job should be created.
   *
   * @var bool
   */
  protected $shouldCreateItem;

  /**
   * ShouldCreateJobEvent constructor.
   *
   * @param \Drupal\tmgmt\JobInterface $job
   *   Continuous job.
   * @param string $plugin
   *   The plugin name.
   * @param string $item_type
   *   The source item type.
   * @param string $item_id
   *   The source item id.
   * @param bool $should_create_item
   *   Whether or not the item should be created.
   */
  public function __construct(JobInterface $job, $plugin, $item_type, $item_id, $should_create_item) {
    $this->job = $job;
    $this->plugin = $plugin;
    $this->itemType = $item_type;
    $this->itemId = $item_id;
    $this->shouldCreateItem = $should_create_item;
  }

  /**
   * Gets the job entity.
   *
   * @return \Drupal\tmgmt\JobInterface
   *   The Job object.
   */
  public function getJob() {
    return $this->job;
  }

  /**
   * Gets the plugin ID.
   *
   * @return string
   *   The plugin ID.
   */
  public function getPlugin() {
    return $this->plugin;
  }

  /**
   * Gets the item type.
   *
   * @return string
   *   The item type.
   */
  public function getItemType() {
    return $this->itemType;
  }

  /**
   * Gets the item id.
   *
   * @return string
   *   The item id.
   */
  public function getItemId() {
    return $this->itemId;
  }

  /**
   * Returns whether the job item should be created.
   *
   * @return bool
   *   Whether or not the job item should be created.
   */
  public function shouldCreateItem() {
    return $this->shouldCreateItem;
  }

  /**
   * Sets whether or not the job item should be created.
   *
   * @param bool $should_create_item
   *   TRUE if the job item should be created, FALSE if not.
   */
  public function setShouldCreateItem($should_create_item) {
    $this->shouldCreateItem = $should_create_item;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ShouldCreateJobEvent::$itemId protected property The source item id.
ShouldCreateJobEvent::$itemType protected property The item type.
ShouldCreateJobEvent::$job protected property Continuous job entity.
ShouldCreateJobEvent::$plugin protected property The plugin ID.
ShouldCreateJobEvent::$shouldCreateItem protected property Whether or not the job should be created.
ShouldCreateJobEvent::getItemId public function Gets the item id.
ShouldCreateJobEvent::getItemType public function Gets the item type.
ShouldCreateJobEvent::getJob public function Gets the job entity.
ShouldCreateJobEvent::getPlugin public function Gets the plugin ID.
ShouldCreateJobEvent::setShouldCreateItem public function Sets whether or not the job item should be created.
ShouldCreateJobEvent::shouldCreateItem public function Returns whether the job item should be created.
ShouldCreateJobEvent::__construct public function ShouldCreateJobEvent constructor.