Fix some rule things.

This commit is contained in:
James Cole
2016-09-24 09:12:17 +02:00
parent 4dcaa96d16
commit f3b9798216
3 changed files with 17 additions and 14 deletions

View File

@@ -63,14 +63,6 @@ final class Processor
Log::debug(sprintf('Making new rule from Rule %d', $rule->id));
$self = new self;
$self->rule = $rule;
/*
* The number of "found triggers" must start at -1, because the first
* trigger is "create-journal" or "update-journal" when this Processor
* is called from a Rule.
*/
$self->setFoundTriggers(-1);
$triggerSet = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
/** @var RuleTrigger $trigger */
foreach ($triggerSet as $trigger) {
@@ -189,7 +181,7 @@ final class Processor
foreach ($this->actions as $action) {
/** @var ActionInterface $actionClass */
$actionClass = ActionFactory::getAction($action);
Log::debug(sprintf('Fire action %s on journal #%d', $actionClass, $this->journal->id));
Log::debug(sprintf('Fire action %s on journal #%d', get_class($actionClass), $this->journal->id));
$actionClass->act($this->journal);
if ($action->stop_processing) {
Log::debug('Stop processing now and break.');
@@ -212,6 +204,7 @@ final class Processor
Log::debug('start of Processor::triggered()');
$foundTriggers = $this->getFoundTriggers();
$hitTriggers = 0;
Log::debug(sprintf('Found triggers starts at %d', $foundTriggers));
/** @var AbstractTrigger $trigger */
foreach ($this->triggers as $trigger) {
$foundTriggers++;