Ver código fonte

Se cambian exception por mensajes en consola, para hacerlo más amigable

Espinoza Guillermo 6 anos atrás
pai
commit
c06267a73f
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6 3
      Command/WorkflowApplyCommand.php

+ 6 - 3
Command/WorkflowApplyCommand.php

@@ -71,12 +71,16 @@ class WorkflowApplyCommand extends ContainerAwareCommand
         
         $entityId = $input->getOption('id');
         if (!class_exists($entityClass)) {
-            throw new \Exception("Class '$entityClass' not found");
+            $output->writeln("Class '$entityClass' not found");
+            
+            return;
         }
         
         $entity = $entity_manager->getRepository($entityClass)->find($entityId);
         if (!$entity) {
-            throw new \Exception("Entity $entityClass with id $entityId not found");
+            $output->writeln("Entity $entityClass with id $entityId not found");
+            
+            return;
         }
         
         // Si no se pasa workflow como parametro se busca según el workflow que tenga
@@ -96,7 +100,6 @@ class WorkflowApplyCommand extends ContainerAwareCommand
         }, $wf->getEnabledTransitions($entity));
         
         if (!in_array($transition, $transitions)) {
-            // throw new \Exception ("Can't apply transition '$transition', only allowed transitions for this entity are '". implode("','", $transitions). "'");
             $output->writeln("Can't apply transition '$transition', only allowed transitions for this entity are '". implode("','", $transitions). "'");
             
             return;