Issue #3363972 by jurgenhaas: Support for ECA
3 unresolved threads
Closes #3363972
Merge request reports
Activity
added 1 commit
- acccf7f1 - Renamed UpdateTriggered to PublishTriggered and added new UnpublishTriggered condition plugin.
added 1 commit
- 31377574 - Verify that the entity type is supported by scheduler
added 5 commits
Toggle commit listadded 6 commits
-
a477b599 - 1 commit from branch
project:2.x
- 0e97eefd - Issue #3363972 by jurgenhaas: Support for ECA
- 3735d964 - Renamed UpdateTriggered to PublishTriggered and added new UnpublishTriggered condition plugin.
- 80e24c23 - Fix CSS
- bbc1eb07 - Verify that the entity type is supported by scheduler
- 75a37801 - Add eca into the composer show
Toggle commit list-
a477b599 - 1 commit from branch
added 1 commit
- 44734dc3 - Added published/unpublished and publish_on/unpublish_on change conditions to...
added 8 commits
-
44734dc3...12c408ca - 2 commits from branch
project:2.x
- 827fc5e5 - Issue #3363972 by jurgenhaas: Support for ECA
- 689625c8 - Renamed UpdateTriggered to PublishTriggered and added new UnpublishTriggered condition plugin.
- 1d0c85c7 - Fix CSS
- 7e9a4516 - Verify that the entity type is supported by scheduler
- 3de37f6f - Add eca into the composer show
- 508cec07 - Added published/unpublished and publish_on/unpublish_on change conditions to...
Toggle commit list-
44734dc3...12c408ca - 2 commits from branch
43 public function evaluate(): bool { 44 $entity = $this->getValueFromContext('entity'); 45 46 if (!isset($entity->original) || !$this->schedulerManager->getPlugin($entity->getEntityTypeId())) { 47 return FALSE; 48 } 49 50 $publish_on_original = !empty($entity->original->publish_on->value ?? NULL); 51 $publish_on = empty($entity->publish_on->value ?? NULL); 52 $published_original = $entity->original->status->value ?? FALSE; 53 $published = $entity->status->value ?? FALSE; 54 55 return $this->negationCheck($publish_on_original) 56 && $this->negationCheck($publish_on) 57 && !$published_original 58 && $published; - Comment on lines +46 to +58
This shouldn't be done that way. The evaluate method needs to determine, if the condition is TRUE or FALSE, and then finally return the negation check with that result. I guess, something like this:
46 if (!isset($entity->original) || !$this->schedulerManager->getPlugin($entity->getEntityTypeId())) { 47 return FALSE; 48 } 49 50 $publish_on_original = !empty($entity->original->publish_on->value ?? NULL); 51 $publish_on = empty($entity->publish_on->value ?? NULL); 52 $published_original = $entity->original->status->value ?? FALSE; 53 $published = $entity->status->value ?? FALSE; 54 55 return $this->negationCheck($publish_on_original) 56 && $this->negationCheck($publish_on) 57 && !$published_original 58 && $published; 46 if (!isset($entity->original) || !$this->schedulerManager->getPlugin($entity->getEntityTypeId())) { 47 $result = FALSE; 48 } 49 else { 50 $publish_on_original = !empty($entity->original->publish_on->value ?? NULL); 51 $publish_on = empty($entity->publish_on->value ?? NULL); 52 $published_original = $entity->original->status->value ?? FALSE; 53 $published = $entity->status->value ?? FALSE; 54 $result = $publish_on_original && $publish_on; 55 } 56 return $this->negationCheck($result); changed this line in version 10 of the diff
43 public function evaluate(): bool { 44 $entity = $this->getValueFromContext('entity'); 45 46 if (!isset($entity->original) || !$this->schedulerManager->getPlugin($entity->getEntityTypeId())) { 47 return FALSE; 48 } 49 50 $unpublish_on_original = !empty($entity->original->unpublish_on->value ?? NULL); 51 $unpublish_on = empty($entity->unpublish_on->value ?? NULL); 52 $published_original = $entity->original->status->value ?? FALSE; 53 $published = $entity->status->value ?? FALSE; 54 55 return $this->negationCheck($unpublish_on_original) 56 && $this->negationCheck($unpublish_on) 57 && $published_original 58 && !$published; changed this line in version 10 of the diff
7 use Symfony\Component\DependencyInjection\ContainerInterface; 8 9 /** 10 * Plugin of the ECA condition "Unpublish triggered by scheduler". 11 * 12 * @EcaCondition( 13 * id = "scheduler_unpublish_triggered_by_scheduler", 14 * label = @Translation("Unpublish triggered by scheduler"), 15 * description = @Translation("This condition determines if the last unpublish of the entity was triggered by the scheduler."), 16 * eca_version_introduced = "2.2.2", 17 * context_definitions = { 18 * "entity" = @ContextDefinition("entity", label = @Translation("Entity")) 19 * } 20 * ) 21 */ 22 class UnpublishTriggeredByScheduler extends ConditionBase { changed this line in version 10 of the diff
added 1 commit
- 67758912 - Refactored for proper use of negationCheck().
Please register or sign in to reply