raoul2000 / yii2-workflow

A simple workflow engine for Yii2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preserve event status (isValid) set by other componets

michelezucchini opened this issue · comments

In order to preserve how $event->isValid value setted by others componets/behaviours, it's better to change:

public function beforeSaveStatus($event)
{
	$event->isValid = $this->sendToStatusInternal($this->getOwnerStatus(), true);
}

public function beforeDelete($event)
{
	$event->isValid = $this->sendToStatusInternal(null, true);
}

to

$event->isValid&= $this->......

In my situation, i have a softdelete behaviour that set $event->isValid to FALSE to preserve the record, but SimpleWorkflowBehavior set it to TRUE!

And the record was really deleted..

Was it the best way to solve this problem?

commented

hi @michelezucchini
good point ! I have merged your PR.
Thanks