Forráskód Böngészése

Fixed transactions also for `Knuckles\Scribe\Extracting\Strategies\Responses\UseTransformerTags` class.

ilGala 4 éve
szülő
commit
1f8ce41e23

+ 3 - 0
src/Extracting/Strategies/Responses/UseApiResourceTags.php

@@ -54,6 +54,7 @@ class UseApiResourceTags extends Strategy
         } catch (Exception $e) {
             c::warn('Exception thrown when fetching Eloquent API resource response for [' . implode(',', $route->methods) . "] {$route->uri}.");
             e::dumpExceptionIfVerbose($e);
+
             return null;
         } finally {
             $this->endDbTransaction();
@@ -65,7 +66,9 @@ class UseApiResourceTags extends Strategy
      *
      * @param Tag[] $tags
      *
+     * @param \Illuminate\Routing\Route $route
      * @return array|null
+     * @throws \Exception
      */
     public function getApiResourceResponse(array $tags, Route $route)
     {

+ 3 - 3
src/Extracting/Strategies/Responses/UseTransformerTags.php

@@ -47,12 +47,15 @@ class UseTransformerTags extends Strategy
         $methodDocBlock = $docBlocks['method'];
 
         try {
+            $this->startDbTransaction();
             return $this->getTransformerResponse($methodDocBlock->getTags());
         } catch (Exception $e) {
             c::warn('Exception thrown when fetching transformer response for [' . implode(',', $route->methods) . "] {$route->uri}.");
             e::dumpExceptionIfVerbose($e);
 
             return null;
+        } finally {
+            $this->endDbTransaction();
         }
     }
 
@@ -160,7 +163,6 @@ class UseTransformerTags extends Strategy
 
     protected function instantiateTransformerModel(string $type, array $factoryStates = [], array $relations = [])
     {
-        $this->startDbTransaction();
         try {
             // try Eloquent model factory
 
@@ -193,8 +195,6 @@ class UseTransformerTags extends Strategy
                     e::dumpExceptionIfVerbose($e);
                 }
             }
-        } finally {
-            $this->endDbTransaction();
         }
 
         return $instance;