소스 검색

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');
         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;