瀏覽代碼

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

Espinoza Guillermo 6 年之前
父節點
當前提交
c06267a73f
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      Command/WorkflowApplyCommand.php

+ 6 - 3
Command/WorkflowApplyCommand.php

@@ -71,12 +71,16 @@ class WorkflowApplyCommand extends ContainerAwareCommand
         
         
         $entityId = $input->getOption('id');
         $entityId = $input->getOption('id');
         if (!class_exists($entityClass)) {
         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);
         $entity = $entity_manager->getRepository($entityClass)->find($entityId);
         if (!$entity) {
         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
         // 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));
         }, $wf->getEnabledTransitions($entity));
         
         
         if (!in_array($transition, $transitions)) {
         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). "'");
             $output->writeln("Can't apply transition '$transition', only allowed transitions for this entity are '". implode("','", $transitions). "'");
             
             
             return;
             return;