-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Workflow] Clarify validator API + fixed unknown "scalar" marking store #20492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,38 @@ | |
namespace Symfony\Component\Workflow\Validator; | ||
|
||
use Symfony\Component\Workflow\Definition; | ||
use Symfony\Component\Workflow\Exception\InvalidDefinitionException; | ||
|
||
/** | ||
* @author Tobias Nyholm <tobias.nyholm@gmail.com> | ||
*/ | ||
class WorkflowValidator implements DefinitionValidatorInterface | ||
{ | ||
private $singlePlace; | ||
|
||
/** | ||
* @param bool $singlePlace | ||
*/ | ||
public function __construct($singlePlace = false) | ||
{ | ||
$this->singlePlace = $singlePlace; | ||
} | ||
|
||
public function validate(Definition $definition, $name) | ||
{ | ||
if ($this->singlePlace) { | ||
foreach ($definition->getTransitions() as $transition) { | ||
if (1 < count($transition->getTos())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was, as is, accepted before (and is actually yoda style). Not sure we should change it now.. |
||
throw new InvalidDefinitionException( | ||
sprintf( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be inlined There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
'The marking store of workflow "%s" can not store many places. But the transition "%s" has too many output (%d). Only one is accepted.', | ||
$name, | ||
$transition->getName(), | ||
count($transition->getTos()) | ||
) | ||
); | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is a kind of bug :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing from 08464c9.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR
descriptiontitle.