mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 17:15:02 +00:00
Add guard to block signatures on related entities without objects
Implemented a guard to prevent signatures on related entities that lack a stored object. It also includes corresponding tests and added translation for the error message in French.
This commit is contained in:
@@ -61,6 +61,25 @@ class EntityWorkflowManager
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the entityWorkflow may associate a stored object.
|
||||
*
|
||||
* Take care that, for various reasons, the method @see{getAssociatedStoredObject} may return null if, for
|
||||
* various reasons, the associated stored object may not be retrieved.
|
||||
*
|
||||
* @return bool return true if the entityWorkflow may associate a stored object
|
||||
*/
|
||||
public function canAssociateStoredObject(EntityWorkflow $entityWorkflow): bool
|
||||
{
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler instanceof EntityWorkflowWithStoredObjectHandlerInterface && $handler->supports($entityWorkflow)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<EntityWorkflow>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user