Skip to content

Commit

Permalink
Merge pull request #135 from ThreeSixtyEu/remove-sensio
Browse files Browse the repository at this point in the history
Remove dependency on Sensio Framework Extra Bundle
  • Loading branch information
endroid authored Oct 22, 2017
2 parents 02235e8 + 1672856 commit 159423a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ This step can be skipped if you only use data URIs to display your images.

``` yml
EndroidQrCodeBundle:
resource: "@EndroidQrCodeBundle/Controller/"
type: annotation
resource: "@EndroidQrCodeBundle/Resources/config/routing.yml"
prefix: /qrcode
```

Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"symfony/templating": "^2.7|^3.0",
"symfony/twig-bundle": "^2.7|^3.0",
"symfony/yaml": "^2.7|^3.0",
"sensio/framework-extra-bundle": "^3.0",
"phpunit/phpunit": "^5.7|^6.0"
},
"autoload": {
Expand Down
19 changes: 10 additions & 9 deletions src/Bundle/QrCodeBundle/Controller/QrCodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace Endroid\QrCode\Bundle\QrCodeBundle\Controller;

use Endroid\QrCode\Factory\QrCodeFactory;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -22,8 +20,6 @@
class QrCodeController extends Controller
{
/**
* @Route("/{text}.{extension}", name="endroid_qrcode_generate", requirements={"text"="[\w\W]+"})
*
* @param Request $request
* @param string $text
* @param string $extension
Expand All @@ -41,16 +37,21 @@ public function generateAction(Request $request, $text, $extension)
}

/**
* @Route("/twig", name="endroid_qrcode_twig_functions")
* @Template()
*
* @return array
* @return Response
*/
public function twigFunctionsAction()
{
return [
if (!$this->has('twig')) {
throw new \LogicException('You can not use the "@Template" annotation if the Twig Bundle is not available.');
}

$param = [
'message' => 'QR Code',
];

$renderedView = $this->get('twig')->render('@EndroidQrCode/QrCode/twigFunctions.html.twig', $param);

return new Response($renderedView, Response::HTTP_OK);
}

/**
Expand Down
11 changes: 11 additions & 0 deletions src/Bundle/QrCodeBundle/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
endroid_qrcode_generate:
path: /{text}.{extension}
requirements:
text: "[\\w\\W]+"
defaults:
_controller: EndroidQrCodeBundle:QrCode:generate

endroid_qrcode_twig_functions:
path: /twig
defaults:
_controller: EndroidQrCodeBundle:QrCode:twigFunctions
1 change: 0 additions & 1 deletion tests/Bundle/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public function registerBundles()
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Endroid\QrCode\Bundle\QrCodeBundle\EndroidQrCodeBundle(),
];

Expand Down
4 changes: 0 additions & 4 deletions tests/Bundle/app/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = require __DIR__.'/../../../vendor/autoload.php';

AnnotationRegistry::registerLoader([$loader, 'loadClass']);
3 changes: 1 addition & 2 deletions tests/Bundle/app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
EndroidQrCodeBundle:
resource: "@EndroidQrCodeBundle/Controller/"
type: annotation
resource: "@EndroidQrCodeBundle/Resources/config/routing.yml"
prefix: /qrcode

0 comments on commit 159423a

Please sign in to comment.