public static function Schedule::loadByNameAndTriggeredBy in Business Rules 2.x
Same name and namespace in other branches
- 8 src/Entity/Schedule.php \Drupal\business_rules\Entity\Schedule::loadByNameAndTriggeredBy()
Load an schedule based on name and triggered by item.
Parameters
string $name: The schedule name.
string $triggeredBy: The triggered by Business Rule item.
Return value
\Drupal\business_rules\Entity\Schedule The schedule entity.
Overrides ScheduleInterface::loadByNameAndTriggeredBy
1 call to Schedule::loadByNameAndTriggeredBy()
- ScheduleTask::execute in src/
Plugin/ BusinessRulesAction/ ScheduleTask.php - Execute the action.
File
- src/
Entity/ Schedule.php, line 473
Class
- Schedule
- Defines the Schedule entity.
Namespace
Drupal\business_rules\EntityCode
public static function loadByNameAndTriggeredBy($name, $triggeredBy) {
$query = \Drupal::entityQuery('business_rules_schedule')
->condition('name', $name)
->condition('triggered_by', $triggeredBy);
$id = $query
->execute();
if (count($id) > 0) {
$schedule = self::load(array_values($id)[0]);
}
else {
$schedule = new self([], 'business_rules_schedule');
}
return $schedule;
}