Skip to content

Commit

Permalink
Fix return type on external quote view action (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed May 23, 2019
1 parent 91cf6db commit ab24bcb
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/CoreBundle/Action/ViewBilling.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@

namespace SolidInvoice\CoreBundle\Action;

use SolidInvoice\CoreBundle\Templating\Template;
use InvalidArgumentException;
use Ramsey\Uuid\Exception\InvalidUuidStringException;
use Ramsey\Uuid\Uuid;
use SolidInvoice\CoreBundle\Templating\Template;
use SolidInvoice\InvoiceBundle\Entity\Invoice;
use SolidInvoice\QuoteBundle\Entity\Quote;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

Expand Down Expand Up @@ -53,9 +58,11 @@ public function __construct(RegistryInterface $registry, AuthorizationCheckerInt
*
* @param string $uuid
*
* @return Response
* @return Template|Response
*
* @throws InvalidArgumentException|InvalidParameterException|InvalidUuidStringException|MissingMandatoryParametersException|NotFoundHttpException|RouteNotFoundException
*/
public function quoteAction(string $uuid): Response
public function quoteAction(string $uuid)
{
$options = [
'repository' => Quote::class,
Expand All @@ -74,6 +81,8 @@ public function quoteAction(string $uuid): Response
* @param string $uuid
*
* @return Response|Template
*
* @throws InvalidArgumentException|InvalidParameterException|InvalidUuidStringException|MissingMandatoryParametersException|NotFoundHttpException|RouteNotFoundException
*/
public function invoiceAction(string $uuid)
{
Expand All @@ -93,7 +102,7 @@ public function invoiceAction(string $uuid)
*
* @return Template|Response
*
* @throws NotFoundHttpException
* @throws NotFoundHttpException|InvalidArgumentException|InvalidUuidStringException|InvalidParameterException|MissingMandatoryParametersException|RouteNotFoundException
*/
private function createResponse(array $options)
{
Expand All @@ -109,10 +118,8 @@ private function createResponse(array $options)
return new RedirectResponse($this->router->generate($options['route'], ['id' => $entity->getId()]));
}

$template = '@SolidInvoiceCore/View/'.$options['entity'].'.html.twig';

return new Template(
$template,
'@SolidInvoiceCore/View/'.$options['entity'].'.html.twig',
[
$options['entity'] => $entity,
'title' => $options['entity'].' #'.$entity->getId(),
Expand Down

0 comments on commit ab24bcb

Please sign in to comment.