|
@@ -89,17 +89,21 @@ class WorkflowInterfaceListener
|
|
{
|
|
{
|
|
$em = $event->getEntityManager();
|
|
$em = $event->getEntityManager();
|
|
$entity = $event->getObject();
|
|
$entity = $event->getObject();
|
|
- if ($entity instanceof \WorkflowBundle\Entity\Workflow) {
|
|
|
|
- // Asigno el workflow a las entidades que soporta que no tengan uno asignado
|
|
|
|
- $supports = $entity->getSupport();
|
|
|
|
- foreach ($supports as $class) {
|
|
|
|
- $entities = $em->getRepository($class)->findBy(['workflow' => null]);
|
|
|
|
- foreach ($entities as $object) {
|
|
|
|
- $object->setWorkflow($entity);
|
|
|
|
- $object->setCurrentState($entity->getInitialPlace($object));
|
|
|
|
- $em->flush($object);
|
|
|
|
|
|
+ try {
|
|
|
|
+ if ($entity instanceof \WorkflowBundle\Entity\Workflow) {
|
|
|
|
+ // Asigno el workflow a las entidades que soporta que no tengan uno asignado
|
|
|
|
+ $supports = $entity->getSupport();
|
|
|
|
+ foreach ($supports as $class) {
|
|
|
|
+ $entities = $em->getRepository($class)->findBy(['workflow' => null]);
|
|
|
|
+ foreach ($entities as $object) {
|
|
|
|
+ $object->setWorkflow($entity);
|
|
|
|
+ $object->setCurrentState($entity->getInitialPlace($object));
|
|
|
|
+ $em->flush($object);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } catch (\Exception $ex) {
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|