diff --git a/app/AppKernel.php b/app/AppKernel.php deleted file mode 100644 index ef068e0300..0000000000 --- a/app/AppKernel.php +++ /dev/null @@ -1,54 +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 8eadc31aeb..0000000000 --- a/app/config/routing.yml +++ /dev/null @@ -1,3 +0,0 @@ -app: - resource: "@AppBundle/Controller/" - type: annotation diff --git a/app/config/services.yml b/app/config/services.yml deleted file mode 100644 index 5a805ca49f..0000000000 --- a/app/config/services.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Learn more about services, parameters and containers at -# http://symfony.com/doc/current/service_container.html -parameters: -# parameter_name: value - -services: -# service_name: -# class: AppBundle\Directory\ClassName -# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] 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 0ffc934b94..d9acfc05e4 100644 --- a/composer.json +++ b/composer.json @@ -3,16 +3,21 @@ "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" ] + "psr-4": { "App\\": "src/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "require": { - "php": ">=5.5.9", - "symfony/symfony": "3.3.x-dev", + "php": ">=7.0.0", + "symfony/symfony": "dev-autowirable_controller as 3.3.0", "doctrine/orm": "^2.5", "doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-cache-bundle": "^1.2", @@ -46,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 e5669e47b4..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": "d7620213af8197665d87a5b909dc19c1", + "content-hash": "111da1c701a220fb5647993c0d698ded", "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": "e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/8f65fc7ec1418593d433e39abb71d3959eb10a0b", - "reference": "8f65fc7ec1418593d433e39abb71d3959eb10a0b", + "url": "https://api.github.com/repos/dunglas/symfony/zipball/e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56", + "reference": "e5fbe6d0c94b17bcc3f7d681a21e4708d54f8b56", "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-22 10:16:55" }, { "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/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 81% rename from app/config/config.yml rename to conf/config.yml index cfb0391133..b3a0a062d0 100644 --- a/app/config/config.yml +++ b/conf/config.yml @@ -1,7 +1,7 @@ imports: - - { resource: parameters.yml } - - { resource: security.yml } - - { resource: services.yml } + - { resource: 'parameters.yml' } + - { resource: 'security.yml' } + - { 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: @@ -60,6 +62,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/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/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/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/src/Controller/Hello.php b/src/Controller/Hello.php new file mode 100644 index 0000000000..40adaa29c2 --- /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 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();