From 001a72886a20c9ba112838c7c8f650273dc06ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 8 Dec 2016 18:06:56 +0100 Subject: [PATCH 1/3] Change the default directory structure and register ActionBundle. Update dependencies --- app/AppKernel.php | 1 - app/config/config.yml | 7 +++ app/config/routing.yml | 4 +- app/config/services.yml | 3 +- composer.json | 8 +++- composer.lock | 47 ++++++++++++------- src/AppBundle/AppBundle.php | 9 ---- .../Controller/DefaultController.php | 21 --------- src/Controller/Hello.php | 24 ++++++++++ src/Entity/.gitkeep | 0 10 files changed, 72 insertions(+), 52 deletions(-) delete mode 100644 src/AppBundle/AppBundle.php delete mode 100644 src/AppBundle/Controller/DefaultController.php create mode 100644 src/Controller/Hello.php create mode 100644 src/Entity/.gitkeep diff --git a/app/AppKernel.php b/app/AppKernel.php index ef068e0300..0db66c8fdf 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -15,7 +15,6 @@ public function registerBundles() new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), - new AppBundle\AppBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/config/config.yml b/app/config/config.yml index cfb0391133..2645ddb338 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -60,6 +60,13 @@ doctrine: auto_generate_proxy_classes: "%kernel.debug%" naming_strategy: doctrine.orm.naming_strategy.underscore auto_mapping: true + mappings: + App: + type: annotation + is_bundle: false + dir: '%kernel.root_dir%/../src/Entity' + prefix: 'Entity' + alias: App # Swiftmailer Configuration swiftmailer: diff --git a/app/config/routing.yml b/app/config/routing.yml index 8eadc31aeb..9ef2054311 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,3 +1,3 @@ -app: - resource: "@AppBundle/Controller/" +action: + resource: "../../src/Controller/" type: annotation diff --git a/app/config/services.yml b/app/config/services.yml index 5a805ca49f..bd60e25f71 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -4,6 +4,5 @@ parameters: # parameter_name: value services: -# service_name: -# class: AppBundle\Directory\ClassName +# 'My\ClassName': # arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/composer.json b/composer.json index 0ffc934b94..bdd7ebd471 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,12 @@ "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/dunglas/symfony" + } + ], "autoload": { "psr-4": { "": "src/" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] @@ -12,7 +18,7 @@ }, "require": { "php": ">=5.5.9", - "symfony/symfony": "3.3.x-dev", + "symfony/symfony": "dev-autowirable_controller as 3.3.0", "doctrine/orm": "^2.5", "doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-cache-bundle": "^1.2", diff --git a/composer.lock b/composer.lock index e5669e47b4..cd6cc9b495 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d7620213af8197665d87a5b909dc19c1", + "content-hash": "37460763ab706773294f23dc4cdebeb2", "packages": [ { "name": "doctrine/annotations", @@ -1315,16 +1315,16 @@ }, { "name": "sensiolabs/security-checker", - "version": "v4.0.0", + "version": "v4.0.1", "source": { "type": "git", "url": "https://github.com/sensiolabs/security-checker.git", - "reference": "116027b57b568ed61b7b1c80eeb4f6ee9e8c599c" + "reference": "f2ce0035fc512287978510ca1740cd111d60f89f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/116027b57b568ed61b7b1c80eeb4f6ee9e8c599c", - "reference": "116027b57b568ed61b7b1c80eeb4f6ee9e8c599c", + "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/f2ce0035fc512287978510ca1740cd111d60f89f", + "reference": "f2ce0035fc512287978510ca1740cd111d60f89f", "shasum": "" }, "require": { @@ -1355,7 +1355,7 @@ } ], "description": "A security checker for your composer.lock", - "time": "2016-09-23T18:09:57+00:00" + "time": "2017-02-18T17:53:25+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -1869,16 +1869,16 @@ }, { "name": "symfony/symfony", - "version": "dev-master", + "version": "dev-autowirable_controller", "source": { "type": "git", - "url": "https://github.com/symfony/symfony.git", - "reference": "8f65fc7ec1418593d433e39abb71d3959eb10a0b" + "url": "https://github.com/dunglas/symfony.git", + "reference": "4f3d68b9caca02d44a81e076f145cbc9e7848f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/8f65fc7ec1418593d433e39abb71d3959eb10a0b", - "reference": "8f65fc7ec1418593d433e39abb71d3959eb10a0b", + "url": "https://api.github.com/repos/dunglas/symfony/zipball/4f3d68b9caca02d44a81e076f145cbc9e7848f62", + "reference": "4f3d68b9caca02d44a81e076f145cbc9e7848f62", "shasum": "" }, "require": { @@ -1897,7 +1897,8 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0", - "phpdocumentor/type-resolver": "<0.2.0" + "phpdocumentor/type-resolver": "<0.2.0", + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "provide": { "psr/cache-implementation": "1.0", @@ -1995,7 +1996,11 @@ "**/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "files": [ + "src/Symfony/Component/VarDumper/Resources/functions/dump.php" + ] + }, "license": [ "MIT" ], @@ -2014,7 +2019,10 @@ "keywords": [ "framework" ], - "time": "2017-02-16 21:52:43" + "support": { + "source": "https://github.com/dunglas/symfony/tree/autowirable_controller" + }, + "time": "2017-02-21 19:18:01" }, { "name": "twig/twig", @@ -2133,7 +2141,7 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v3.2.3", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", @@ -2191,7 +2199,14 @@ "time": "2017-01-21T17:06:35+00:00" } ], - "aliases": [], + "aliases": [ + { + "alias": "3.3.0", + "alias_normalized": "3.3.0.0", + "version": "dev-autowirable_controller", + "package": "symfony/symfony" + } + ], "minimum-stability": "stable", "stability-flags": { "symfony/symfony": 20 diff --git a/src/AppBundle/AppBundle.php b/src/AppBundle/AppBundle.php deleted file mode 100644 index 05123b6782..0000000000 --- a/src/AppBundle/AppBundle.php +++ /dev/null @@ -1,9 +0,0 @@ -render('default/index.html.twig', [ - 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR, - ]); - } -} diff --git a/src/Controller/Hello.php b/src/Controller/Hello.php new file mode 100644 index 0000000000..869a700b23 --- /dev/null +++ b/src/Controller/Hello.php @@ -0,0 +1,24 @@ +render('default/index.html.twig', [ + 'base_dir' => realpath(__DIR__.'/../..').DIRECTORY_SEPARATOR, + ]); + } +} diff --git a/src/Entity/.gitkeep b/src/Entity/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 From fdce70482eef402af10f4ec9dbd3489a1183b965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 22 Feb 2017 11:26:13 +0100 Subject: [PATCH 2/3] Use new 3.3 features --- app/config/config.yml | 6 +++--- app/config/{services.yml => services/app.yml} | 3 +++ app/config/services/framework.yml | 21 +++++++++++++++++++ composer.json | 2 +- composer.lock | 8 +++---- src/Controller/Hello.php | 2 +- 6 files changed, 33 insertions(+), 9 deletions(-) rename app/config/{services.yml => services/app.yml} (75%) create mode 100644 app/config/services/framework.yml diff --git a/app/config/config.yml b/app/config/config.yml index 2645ddb338..8578a5995d 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -1,7 +1,7 @@ imports: - - { resource: parameters.yml } - - { resource: security.yml } - - { resource: services.yml } + - { resource: 'parameters.yml' } + - { resource: 'security.yml' } + - { resource: 'services/*' } # Put parameters here that don't need to change on each machine where the app is deployed # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration diff --git a/app/config/services.yml b/app/config/services/app.yml similarity index 75% rename from app/config/services.yml rename to app/config/services/app.yml index bd60e25f71..8e090bd814 100644 --- a/app/config/services.yml +++ b/app/config/services/app.yml @@ -4,5 +4,8 @@ parameters: # parameter_name: value services: + _defaults: + public: false # Making services private improve performances + # 'My\ClassName': # arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/app/config/services/framework.yml b/app/config/services/framework.yml new file mode 100644 index 0000000000..2e5dfa7716 --- /dev/null +++ b/app/config/services/framework.yml @@ -0,0 +1,21 @@ +services: + _defaults: + # Enable constructor and getter autowiring for all services defined in this file + autowire: ['__construct', 'get*'] + + _instanceof: + # Add the console.command tag to all services defined in this file having this type + Symfony\Component\Console\Command\Command: + tags: ['console.command'] + + Twig_ExtensionInterface: + tags: ['twig.extension'] + public: false + + Symfony\Component\EventDispatcher\EventSubscriberInterface: + tags: ['kernel.event_subscriber'] + public: false + + # Register all classes in these directories as services + App\: + resource: '../../../src/{Controller,Command,EventSubscriber,Twig}' diff --git a/composer.json b/composer.json index bdd7ebd471..c283f422ce 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "autoload": { - "psr-4": { "": "src/" }, + "psr-4": { "App\\": "src/" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] }, "autoload-dev": { diff --git a/composer.lock b/composer.lock index cd6cc9b495..5827b28bda 100644 --- a/composer.lock +++ b/composer.lock @@ -1873,12 +1873,12 @@ "source": { "type": "git", "url": "https://github.com/dunglas/symfony.git", - "reference": "4f3d68b9caca02d44a81e076f145cbc9e7848f62" + "reference": "e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dunglas/symfony/zipball/4f3d68b9caca02d44a81e076f145cbc9e7848f62", - "reference": "4f3d68b9caca02d44a81e076f145cbc9e7848f62", + "url": "https://api.github.com/repos/dunglas/symfony/zipball/e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56", + "reference": "e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56", "shasum": "" }, "require": { @@ -2022,7 +2022,7 @@ "support": { "source": "https://github.com/dunglas/symfony/tree/autowirable_controller" }, - "time": "2017-02-21 19:18:01" + "time": "2017-02-22 10:16:55" }, { "name": "twig/twig", diff --git a/src/Controller/Hello.php b/src/Controller/Hello.php index 869a700b23..40adaa29c2 100644 --- a/src/Controller/Hello.php +++ b/src/Controller/Hello.php @@ -1,6 +1,6 @@ Date: Wed, 22 Feb 2017 15:54:19 +0100 Subject: [PATCH 3/3] New directory structure --- app/AppKernel.php | 53 --------------- app/config/routing.yml | 3 - app/config/services/app.yml | 11 --- app/config/services/framework.yml | 21 ------ bin/console | 3 +- composer.json | 11 ++- composer.lock | 2 +- {app => conf}/.htaccess | 0 {app => conf}/autoload.php | 0 {app/config => conf}/config.yml | 6 +- .../config_dev.yml => conf/dev/config.yml | 4 +- .../routing_dev.yml => conf/dev/routing.yml | 2 +- conf/parameters.yml | 12 ++++ {app/config => conf}/parameters.yml.dist | 0 .../config_prod.yml => conf/prod/config.yml | 2 +- conf/routing.yml | 3 + {app/config => conf}/security.yml | 0 conf/services.yml | 40 +++++++++++ .../config_test.yml => conf/test/config.yml | 2 +- {app => src}/AppCache.php | 2 + src/AppKernel.php | 67 +++++++++++++++++++ .../default/index.html.twig | 2 +- .../layout.html.twig | 0 web/app.php | 11 +-- web/app_dev.php | 6 +- 25 files changed, 147 insertions(+), 116 deletions(-) delete mode 100644 app/AppKernel.php delete mode 100644 app/config/routing.yml delete mode 100644 app/config/services/app.yml delete mode 100644 app/config/services/framework.yml rename {app => conf}/.htaccess (100%) rename {app => conf}/autoload.php (100%) rename {app/config => conf}/config.yml (94%) rename app/config/config_dev.yml => conf/dev/config.yml (89%) rename app/config/routing_dev.yml => conf/dev/routing.yml (90%) create mode 100644 conf/parameters.yml rename {app/config => conf}/parameters.yml.dist (100%) rename app/config/config_prod.yml => conf/prod/config.yml (92%) create mode 100644 conf/routing.yml rename {app/config => conf}/security.yml (100%) create mode 100644 conf/services.yml rename app/config/config_test.yml => conf/test/config.yml (85%) rename {app => src}/AppCache.php (86%) create mode 100644 src/AppKernel.php rename {app/Resources/views => templates}/default/index.html.twig (99%) rename app/Resources/views/base.html.twig => templates/layout.html.twig (100%) diff --git a/app/AppKernel.php b/app/AppKernel.php deleted file mode 100644 index 0db66c8fdf..0000000000 --- a/app/AppKernel.php +++ /dev/null @@ -1,53 +0,0 @@ -getEnvironment(), ['dev', 'test'], true)) { - $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); - $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); - $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); - - if ('dev' === $this->getEnvironment()) { - $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); - $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); - } - } - - return $bundles; - } - - public function getRootDir() - { - return __DIR__; - } - - public function getCacheDir() - { - return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); - } - - public function getLogDir() - { - return dirname(__DIR__).'/var/logs'; - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); - } -} diff --git a/app/config/routing.yml b/app/config/routing.yml deleted file mode 100644 index 9ef2054311..0000000000 --- a/app/config/routing.yml +++ /dev/null @@ -1,3 +0,0 @@ -action: - resource: "../../src/Controller/" - type: annotation diff --git a/app/config/services/app.yml b/app/config/services/app.yml deleted file mode 100644 index 8e090bd814..0000000000 --- a/app/config/services/app.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Learn more about services, parameters and containers at -# http://symfony.com/doc/current/service_container.html -parameters: -# parameter_name: value - -services: - _defaults: - public: false # Making services private improve performances - -# 'My\ClassName': -# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] diff --git a/app/config/services/framework.yml b/app/config/services/framework.yml deleted file mode 100644 index 2e5dfa7716..0000000000 --- a/app/config/services/framework.yml +++ /dev/null @@ -1,21 +0,0 @@ -services: - _defaults: - # Enable constructor and getter autowiring for all services defined in this file - autowire: ['__construct', 'get*'] - - _instanceof: - # Add the console.command tag to all services defined in this file having this type - Symfony\Component\Console\Command\Command: - tags: ['console.command'] - - Twig_ExtensionInterface: - tags: ['twig.extension'] - public: false - - Symfony\Component\EventDispatcher\EventSubscriberInterface: - tags: ['kernel.event_subscriber'] - public: false - - # Register all classes in these directories as services - App\: - resource: '../../../src/{Controller,Command,EventSubscriber,Twig}' diff --git a/bin/console b/bin/console index a908aaa939..d9bb9c70e8 100755 --- a/bin/console +++ b/bin/console @@ -1,6 +1,7 @@ #!/usr/bin/env php getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); diff --git a/composer.json b/composer.json index c283f422ce..d9acfc05e4 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,13 @@ } ], "autoload": { - "psr-4": { "App\\": "src/" }, - "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] + "psr-4": { "App\\": "src/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "require": { - "php": ">=5.5.9", + "php": ">=7.0.0", "symfony/symfony": "dev-autowirable_controller as 3.3.0", "doctrine/orm": "^2.5", "doctrine/doctrine-bundle": "^1.6", @@ -52,18 +51,18 @@ }, "config": { "platform": { - "php": "5.5.9" + "php": "7.0.0" } }, "extra": { - "symfony-app-dir": "app", + "symfony-app-dir": "conf", "symfony-bin-dir": "bin", "symfony-var-dir": "var", "symfony-web-dir": "web", "symfony-tests-dir": "tests", "symfony-assets-install": "relative", "incenteev-parameters": { - "file": "app/config/parameters.yml" + "file": "conf/parameters.yml" }, "branch-alias": { "dev-master": "3.3-dev" diff --git a/composer.lock b/composer.lock index 5827b28bda..fe23caf92c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "37460763ab706773294f23dc4cdebeb2", + "content-hash": "111da1c701a220fb5647993c0d698ded", "packages": [ { "name": "doctrine/annotations", diff --git a/app/.htaccess b/conf/.htaccess similarity index 100% rename from app/.htaccess rename to conf/.htaccess diff --git a/app/autoload.php b/conf/autoload.php similarity index 100% rename from app/autoload.php rename to conf/autoload.php diff --git a/app/config/config.yml b/conf/config.yml similarity index 94% rename from app/config/config.yml rename to conf/config.yml index 8578a5995d..b3a0a062d0 100644 --- a/app/config/config.yml +++ b/conf/config.yml @@ -1,7 +1,7 @@ imports: - { resource: 'parameters.yml' } - { resource: 'security.yml' } - - { resource: 'services/*' } + - { resource: 'services.yml' } # Put parameters here that don't need to change on each machine where the app is deployed # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration @@ -13,7 +13,7 @@ framework: #translator: { fallbacks: ["%locale%"] } secret: "%secret%" router: - resource: "%kernel.root_dir%/config/routing.yml" + resource: "%kernel.root_dir%/../conf/routing.yml" strict_requirements: ~ form: ~ csrf_protection: ~ @@ -38,6 +38,8 @@ framework: twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" + paths: + - '%kernel.root_dir%/../templates' # Doctrine Configuration doctrine: diff --git a/app/config/config_dev.yml b/conf/dev/config.yml similarity index 89% rename from app/config/config_dev.yml rename to conf/dev/config.yml index 40b091490f..c9c573bdf7 100644 --- a/app/config/config_dev.yml +++ b/conf/dev/config.yml @@ -1,9 +1,9 @@ imports: - - { resource: config.yml } + - { resource: '../config.yml' } framework: router: - resource: "%kernel.root_dir%/config/routing_dev.yml" + resource: "%kernel.root_dir%/../conf/dev/routing.yml" strict_requirements: true profiler: { only_exceptions: false } diff --git a/app/config/routing_dev.yml b/conf/dev/routing.yml similarity index 90% rename from app/config/routing_dev.yml rename to conf/dev/routing.yml index 404f6a3bce..1a9c520710 100644 --- a/app/config/routing_dev.yml +++ b/conf/dev/routing.yml @@ -11,4 +11,4 @@ _errors: prefix: /_error _main: - resource: routing.yml + resource: '../routing.yml' diff --git a/conf/parameters.yml b/conf/parameters.yml new file mode 100644 index 0000000000..837bd1b55c --- /dev/null +++ b/conf/parameters.yml @@ -0,0 +1,12 @@ +# This file is auto-generated during the composer install +parameters: + database_host: 127.0.0.1 + database_port: null + database_name: symfony + database_user: root + database_password: null + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + secret: ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/parameters.yml.dist b/conf/parameters.yml.dist similarity index 100% rename from app/config/parameters.yml.dist rename to conf/parameters.yml.dist diff --git a/app/config/config_prod.yml b/conf/prod/config.yml similarity index 92% rename from app/config/config_prod.yml rename to conf/prod/config.yml index 192f0c5c6e..1c079dee0f 100644 --- a/app/config/config_prod.yml +++ b/conf/prod/config.yml @@ -1,5 +1,5 @@ imports: - - { resource: config.yml } + - { resource: '../config.yml' } #doctrine: # orm: diff --git a/conf/routing.yml b/conf/routing.yml new file mode 100644 index 0000000000..629f7d9392 --- /dev/null +++ b/conf/routing.yml @@ -0,0 +1,3 @@ +action: + resource: "../src/Controller/" + type: annotation diff --git a/app/config/security.yml b/conf/security.yml similarity index 100% rename from app/config/security.yml rename to conf/security.yml diff --git a/conf/services.yml b/conf/services.yml new file mode 100644 index 0000000000..50280e9932 --- /dev/null +++ b/conf/services.yml @@ -0,0 +1,40 @@ +# Learn more about services, parameters and containers at +# http://symfony.com/doc/current/service_container.html +parameters: +# parameter_name: value + +services: +# 'My\ClassName': ~ + +# Auto-register common directories + _defaults: + # Enable constructor and getter autowiring for all services defined in this file + autowire: ['__construct', 'get*'] + public: false + + _instanceof: + # Add some common tags to enable feature auto-registration + Symfony\Component\Console\Command\Command: + tags: ['console.command'] + public: true # Mandatory + + Twig_ExtensionInterface: + tags: ['twig.extension'] + + Symfony\Component\EventDispatcher\EventSubscriberInterface: + tags: ['kernel.event_subscriber'] + + Symfony\Component\Form\FormTypeInterface: + tags: ['form.type'] + public: true # Mandatory + + Symfony\Component\Security\Core\Authorization\VoterInterface: + tags: ['security.voter'] + + # Register all classes in these directories as services + App\: + resource: '../src/{Command,EventSubscriber,Twig,Form,Voter}' + + App\Controller\: + resource: '../src/Controller' + public: true # Mandatory diff --git a/app/config/config_test.yml b/conf/test/config.yml similarity index 85% rename from app/config/config_test.yml rename to conf/test/config.yml index 2f6d92503f..b6ff2be750 100644 --- a/app/config/config_test.yml +++ b/conf/test/config.yml @@ -1,5 +1,5 @@ imports: - - { resource: config_dev.yml } + - { resource: '../dev/config.yml' } framework: test: ~ diff --git a/app/AppCache.php b/src/AppCache.php similarity index 86% rename from app/AppCache.php rename to src/AppCache.php index 639ec2cd7e..fde0b9d95a 100644 --- a/app/AppCache.php +++ b/src/AppCache.php @@ -1,5 +1,7 @@ getEnvironment(), ['dev', 'test'], true)) { + $bundles[] = new DebugBundle(); + $bundles[] = new WebProfilerBundle(); + $bundles[] = new SensioDistributionBundle(); + + if ('dev' === $this->getEnvironment()) { + $bundles[] = new SensioGeneratorBundle(); + $bundles[] = new WebServerBundle(); + } + } + + return $bundles; + } + + public function getRootDir() + { + return __DIR__; + } + + public function getCacheDir() + { + return dirname(__DIR__).'/../var/cache/'.$this->getEnvironment(); + } + + public function getLogDir() + { + return dirname(__DIR__).'/../var/logs'; + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load($this->getRootDir().'/../conf/'.$this->getEnvironment().'/config.yml'); + } +} diff --git a/app/Resources/views/default/index.html.twig b/templates/default/index.html.twig similarity index 99% rename from app/Resources/views/default/index.html.twig rename to templates/default/index.html.twig index 1ce2bac829..337e5e1f6b 100644 --- a/app/Resources/views/default/index.html.twig +++ b/templates/default/index.html.twig @@ -1,4 +1,4 @@ -{% extends 'base.html.twig' %} +{% extends 'layout.html.twig' %} {% block body %}
diff --git a/app/Resources/views/base.html.twig b/templates/layout.html.twig similarity index 100% rename from app/Resources/views/base.html.twig rename to templates/layout.html.twig diff --git a/web/app.php b/web/app.php index c1ac2853f7..1ccc607e6f 100644 --- a/web/app.php +++ b/web/app.php @@ -1,17 +1,12 @@ loadClassCache(); -} //$kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter diff --git a/web/app_dev.php b/web/app_dev.php index 45daacfdc5..60fc09ab13 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -1,5 +1,6 @@ loadClassCache(); -} $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send();