diff --git a/.gitignore b/.gitignore index 46d2f59ac..fc9b96879 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /app/bootstrap.php.cache /app/cache/* /app/logs/* +/app/data/blog.sqlite !app/cache/.gitkeep !app/logs/.gitkeep /build/ diff --git a/.travis.yml b/.travis.yml index 9b38a1e29..ac02639a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,6 @@ cache: matrix: fast_finish: true include: - - php: 5.3 - - php: 5.4 - php: 5.5 - php: 5.6 - php: 7.0 diff --git a/app/AppKernel.php b/app/AppKernel.php index bef8fcac8..14df2a14f 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -19,6 +19,7 @@ public function registerBundles() new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), + new Dunglas\ActionBundle\DunglasActionBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new CodeExplorerBundle\CodeExplorerBundle(), diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index 28b0dcdbf..841338f44 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -425,11 +425,13 @@ public function __construct() 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' ); - $this->addPhpIniRequirement( - 'date.timezone', true, false, - 'date.timezone setting must be set', - 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' - ); + if (version_compare($installedPhpVersion, '7.0.0', '<')) { + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + } if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { $timezones = array(); @@ -677,6 +679,14 @@ function_exists('posix_isatty'), 'Upgrade your intl extension with a newer ICU version (4+).' ); + if (class_exists('Symfony\Component\Intl\Intl')) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system (%s) should match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.' + ); + } + $this->addPhpIniRecommendation( 'intl.error_level', create_function('$cfgValue', 'return (int) $cfgValue === 0;'), diff --git a/app/config/config.yml b/app/config/config.yml index 2d066320f..c303d4217 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -38,6 +38,7 @@ framework: form: ~ csrf_protection: ~ validation: { enable_annotations: true } + #serializer: { enable_annotations: true } templating: engines: ['twig'] default_locale: "%locale%" diff --git a/app/config/services.yml b/app/config/services.yml index 75d07f552..3a853520e 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -1,18 +1,17 @@ services: - # First we define some basic services to make these utilities available in - # the entire application + # Required for fixtures slugger: - class: AppBundle\Utils\Slugger - - markdown: - class: AppBundle\Utils\Markdown + class: AppBundle\Utils\Slugger # These are the Twig extensions that create new filters and functions for # using them in the templates app.twig.app_extension: public: false class: AppBundle\Twig\AppExtension - arguments: ['@markdown', %app_locales%] + autowire: true + arguments: + # the first argument is autowired + 1: %app_locales% tags: - { name: twig.extension } @@ -23,8 +22,11 @@ services: - { name: twig.extension } app.redirect_to_preferred_locale_listener: - class: AppBundle\EventListener\RedirectToPreferredLocaleListener - arguments: ['@router', %app_locales%, %locale%] + class: AppBundle\EventListener\RedirectToPreferredLocaleListener + autowire: true + arguments: + 1: %app_locales% + 2: %locale% tags: - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } diff --git a/app/data/blog.sqlite b/app/data/blog.sqlite deleted file mode 100644 index 287a6fc07..000000000 Binary files a/app/data/blog.sqlite and /dev/null differ diff --git a/composer.json b/composer.json index 7b78dffb8..b4b5d6cc3 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "symfony/monolog-bundle" : "~2.7", "symfony/swiftmailer-bundle" : "~2.3", "symfony/symfony" : "~2.8", - "twig/extensions" : "~1.2" + "twig/extensions" : "~1.2", + "dunglas/action-bundle" : "~1.0@dev" }, "require-dev": { "sensio/generator-bundle": "~3.0" @@ -52,7 +53,7 @@ "config": { "bin-dir": "bin", "platform": { - "php": "5.3.9" + "php": "5.5.9" } }, "extra": { diff --git a/composer.lock b/composer.lock index 94b94650d..b1f5f189f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "41d575e7bd2fd8f7dc20543cc751e975", - "content-hash": "d03660a96f1d5f2f6b6bc93f894b244b", + "hash": "6bf69bb8673e9db417e92b497ce57695", + "content-hash": "658db82d1feaebc7bb7578d0c36d2465", "packages": [ { "name": "doctrine/annotations", @@ -77,33 +77,33 @@ }, { "name": "doctrine/cache", - "version": "v1.5.4", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136" + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/47cdc76ceb95cc591d9c79a36dc3794975b5d136", - "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136", + "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "~5.5|~7.0" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "phpunit/phpunit": ">=3.7", + "phpunit/phpunit": "~4.8|~5.0", "predis/predis": "~1.0", "satooshi/php-coveralls": "~0.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -143,7 +143,7 @@ "cache", "caching" ], - "time": "2015-12-19 05:03:47" + "time": "2015-12-31 16:37:02" }, { "name": "doctrine/collections", @@ -213,16 +213,16 @@ }, { "name": "doctrine/common", - "version": "v2.5.3", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "10f1f19651343f87573129ca970aef1a47a6f29e" + "reference": "a579557bc689580c19fee4e27487a67fe60defc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/10f1f19651343f87573129ca970aef1a47a6f29e", - "reference": "10f1f19651343f87573129ca970aef1a47a6f29e", + "url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0", "shasum": "" }, "require": { @@ -231,20 +231,20 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "~5.5|~7.0" }, "require-dev": { - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "~4.8|~5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.7.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\": "lib/" + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" } }, "notification-url": "https://packagist.org/downloads/", @@ -282,7 +282,7 @@ "persistence", "spl" ], - "time": "2015-12-25 13:10:16" + "time": "2015-12-25 13:18:31" }, { "name": "doctrine/data-fixtures", @@ -703,6 +703,60 @@ ], "time": "2015-11-06 14:35:42" }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, { "name": "doctrine/lexer", "version": "v1.0.1", @@ -759,28 +813,31 @@ }, { "name": "doctrine/orm", - "version": "v2.4.8", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "5aedac1e5c5caaeac14798822c70325dc242d467" + "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/5aedac1e5c5caaeac14798822c70325dc242d467", - "reference": "5aedac1e5c5caaeac14798822c70325dc242d467", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/bc4ddbfb0114cb33438cc811c9a740d8aa304aab", + "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab", "shasum": "" }, "require": { - "doctrine/collections": "~1.1", - "doctrine/dbal": "~2.4", + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.7-dev", + "doctrine/dbal": ">=2.5-dev,<2.6-dev", + "doctrine/instantiator": "~1.0.1", "ext-pdo": "*", - "php": ">=5.3.2", - "symfony/console": "~2.0" + "php": ">=5.4", + "symfony/console": "~2.5|~3.0" }, "require-dev": { - "satooshi/php-coveralls": "dev-master", - "symfony/yaml": "~2.1" + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0" }, "suggest": { "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" @@ -792,7 +849,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.6.x-dev" } }, "autoload": { @@ -828,7 +885,74 @@ "database", "orm" ], - "time": "2015-08-31 13:19:01" + "time": "2016-01-05 21:34:58" + }, + { + "name": "dunglas/action-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/dunglas/DunglasActionBundle.git", + "reference": "2c262bc28e7b2629de98aca1840cdb15dc21d06e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dunglas/DunglasActionBundle/zipball/2c262bc28e7b2629de98aca1840cdb15dc21d06e", + "reference": "2c262bc28e7b2629de98aca1840cdb15dc21d06e", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "require-dev": { + "sensio/framework-extra-bundle": "~3.0", + "symfony/browser-kit": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/framework-bundle": "~2.8|~3.0" + }, + "suggest": { + "symfony/routing": "To use the @Route annotation provided by the bundle." + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dunglas\\ActionBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com", + "homepage": "https://dunglas.fr" + } + ], + "description": "Symfony controllers, redesigned", + "homepage": "https://dunglas.fr/2016/01/dunglasactionbundle-symfony-controllers-redesigned/", + "keywords": [ + "Autowiring", + "action", + "controllers", + "routing", + "symfony" + ], + "time": "2016-03-29 20:24:33" }, { "name": "erusev/parsedown", @@ -1320,16 +1444,16 @@ }, { "name": "monolog/monolog", - "version": "1.18.0", + "version": "1.18.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "e19b764b5c855580e8ffa7e615f72c10fd2f99cc" + "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/e19b764b5c855580e8ffa7e615f72c10fd2f99cc", - "reference": "e19b764b5c855580e8ffa7e615f72c10fd2f99cc", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", + "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", "shasum": "" }, "require": { @@ -1394,20 +1518,20 @@ "logging", "psr-3" ], - "time": "2016-03-01 18:00:40" + "time": "2016-03-13 16:08:35" }, { "name": "paragonie/random_compat", - "version": "v1.2.1", + "version": "v1.4.1", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc" + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/c7e26a21ba357863de030f0b9e701c7d04593774", + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774", "shasum": "" }, "require": { @@ -1442,7 +1566,7 @@ "pseudorandom", "random" ], - "time": "2016-02-29 17:25:04" + "time": "2016-03-18 20:34:03" }, { "name": "patchwork/jsqueeze", @@ -1526,16 +1650,16 @@ }, { "name": "sensio/distribution-bundle", - "version": "v5.0.4", + "version": "v5.0.5", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "2c167426fc24f9de116345195bc1697a748ee847" + "reference": "3a160355bb1364da55ed9e415c1aa1fa8d457b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/2c167426fc24f9de116345195bc1697a748ee847", - "reference": "2c167426fc24f9de116345195bc1697a748ee847", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/3a160355bb1364da55ed9e415c1aa1fa8d457b6f", + "reference": "3a160355bb1364da55ed9e415c1aa1fa8d457b6f", "shasum": "" }, "require": { @@ -1574,20 +1698,20 @@ "configuration", "distribution" ], - "time": "2016-02-12 16:21:30" + "time": "2016-03-15 16:21:41" }, { "name": "sensio/framework-extra-bundle", - "version": "v3.0.14", + "version": "v3.0.16", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "cccf975c565ccd835bddc30a8fea5cdfe3357bf1" + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/cccf975c565ccd835bddc30a8fea5cdfe3357bf1", - "reference": "cccf975c565ccd835bddc30a8fea5cdfe3357bf1", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/507a15f56fa7699f6cc8c2c7de4080b19ce22546", + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546", "shasum": "" }, "require": { @@ -1636,7 +1760,7 @@ "annotations", "controllers" ], - "time": "2016-03-01 10:50:07" + "time": "2016-03-25 17:08:27" }, { "name": "sensiolabs/security-checker", @@ -1737,16 +1861,16 @@ }, { "name": "symfony/assetic-bundle", - "version": "v2.7.1", + "version": "v2.8.0", "source": { "type": "git", "url": "https://github.com/symfony/assetic-bundle.git", - "reference": "d885ec8451d5a7b077bda81bb19ac9fbff9cdc76" + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/assetic-bundle/zipball/d885ec8451d5a7b077bda81bb19ac9fbff9cdc76", - "reference": "d885ec8451d5a7b077bda81bb19ac9fbff9cdc76", + "url": "https://api.github.com/repos/symfony/assetic-bundle/zipball/aa5b4f8b712f38745928fa845ddb73300bb2af6d", + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d", "shasum": "" }, "require": { @@ -1803,20 +1927,20 @@ "compression", "minification" ], - "time": "2015-11-17 09:45:47" + "time": "2015-12-28 13:12:39" }, { "name": "symfony/monolog-bundle", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4" + "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4", - "reference": "27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/82fd8f36e2cccbe94faf237403c48052d4d4b77e", + "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e", "shasum": "" }, "require": { @@ -1828,6 +1952,7 @@ "symfony/monolog-bridge": "~2.3|~3.0" }, "require-dev": { + "phpunit/phpunit": "^4.8", "symfony/console": "~2.3|~3.0", "symfony/yaml": "~2.3|~3.0" }, @@ -1862,20 +1987,20 @@ "log", "logging" ], - "time": "2016-03-01 17:53:42" + "time": "2016-03-13 15:55:56" }, { "name": "symfony/polyfill-apcu", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c" + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", "shasum": "" }, "require": { @@ -1890,9 +2015,6 @@ "autoload": { "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1918,26 +2040,29 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-03-03 16:49:40" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165" + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/66b0bb4abda229bc073eff6bbc8f2685bdaac165", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/8328069d9f5322f0e7b3c3518485acfdc94c3942", + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/intl": "~2.3|~3.0" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -1973,11 +2098,11 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-02-26 16:18:12" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -2036,16 +2161,16 @@ }, { "name": "symfony/polyfill-php54", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054" + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/74663d5a2ff3c530c1bc0571500e0feec9094054", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/9ba741ca01c77282ecf5796c2c1d667f03454ffb", + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb", "shasum": "" }, "require": { @@ -2090,11 +2215,11 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-01-25 19:13:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", @@ -2150,7 +2275,7 @@ }, { "name": "symfony/polyfill-php56", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", @@ -2206,16 +2331,16 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95" + "reference": "386c1be9cad3ab531425211919e78c37971be4ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/8428ceddbbaf102f2906769a8ef2438220c5cb95", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/386c1be9cad3ab531425211919e78c37971be4ce", + "reference": "386c1be9cad3ab531425211919e78c37971be4ce", "shasum": "" }, "require": { @@ -2261,11 +2386,11 @@ "portable", "shim" ], - "time": "2016-01-25 08:44:42" + "time": "2016-01-28 22:42:02" }, { "name": "symfony/polyfill-util", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", @@ -2435,16 +2560,16 @@ }, { "name": "symfony/symfony", - "version": "v2.8.3", + "version": "v2.8.4", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2" + "reference": "9e14f9f4869c19188a376eab61d9a1c1f1fee347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/7a9a5fce7ce6e448e527f635463dda00761e12c2", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2", + "url": "https://api.github.com/repos/symfony/symfony/zipball/9e14f9f4869c19188a376eab61d9a1c1f1fee347", + "reference": "9e14f9f4869c19188a376eab61d9a1c1f1fee347", "shasum": "" }, "require": { @@ -2531,11 +2656,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", - "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", - "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", - "Symfony\\Bridge\\Swiftmailer\\": "src/Symfony/Bridge/Swiftmailer/", - "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", + "Symfony\\Bridge\\": "src/Symfony/Bridge/", "Symfony\\Bundle\\": "src/Symfony/Bundle/", "Symfony\\Component\\": "src/Symfony/Component/" }, @@ -2565,7 +2686,7 @@ "keywords": [ "framework" ], - "time": "2016-02-28 21:06:29" + "time": "2016-03-27 12:57:53" }, { "name": "twig/extensions", @@ -2737,7 +2858,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "dunglas/action-bundle": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -2746,6 +2869,6 @@ }, "platform-dev": [], "platform-overrides": { - "php": "5.3.9" + "php": "5.5.9" } } diff --git a/src/AppBundle/Command/AddUserCommand.php b/src/AppBundle/Command/AddUserCommand.php index dde43f722..deeb74a0c 100644 --- a/src/AppBundle/Command/AddUserCommand.php +++ b/src/AppBundle/Command/AddUserCommand.php @@ -11,7 +11,8 @@ namespace AppBundle\Command; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Doctrine\Common\Persistence\ManagerRegistry; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -19,6 +20,7 @@ use Symfony\Component\Console\Question\Question; use Doctrine\Common\Persistence\ObjectManager; use AppBundle\Entity\User; +use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; /** * A command console that creates users and stores them in the database. @@ -34,16 +36,28 @@ * See http://symfony.com/doc/current/cookbook/console/console_command.html * * @author Javier Eguiluz + * @author Kévin Dunglas */ -class AddUserCommand extends ContainerAwareCommand +class AddUserCommand extends Command { const MAX_ATTEMPTS = 5; + private $doctrine; + private $passwordEndoder; + /** * @var ObjectManager */ private $entityManager; + public function __construct(ManagerRegistry $doctrine, UserPasswordEncoderInterface $passwordEncoder) + { + parent::__construct(); + + $this->doctrine = $doctrine; + $this->passwordEndoder = $passwordEncoder; + } + /** * {@inheritdoc} */ @@ -73,7 +87,7 @@ protected function configure() */ protected function initialize(InputInterface $input, OutputInterface $output) { - $this->entityManager = $this->getContainer()->get('doctrine')->getManager(); + $this->entityManager = $this->doctrine->getManager(); } /** @@ -190,8 +204,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $user->setRoles(array($isAdmin ? 'ROLE_ADMIN' : 'ROLE_USER')); // See http://symfony.com/doc/current/book/security.html#security-encoding-password - $encoder = $this->getContainer()->get('security.password_encoder'); - $encodedPassword = $encoder->encodePassword($user, $plainPassword); + $encodedPassword = $this->passwordEndoder->encodePassword($user, $plainPassword); $user->setPassword($encodedPassword); $this->entityManager->persist($user); diff --git a/src/AppBundle/Command/DeleteUserCommand.php b/src/AppBundle/Command/DeleteUserCommand.php index a775ca878..5bf6fa1a5 100644 --- a/src/AppBundle/Command/DeleteUserCommand.php +++ b/src/AppBundle/Command/DeleteUserCommand.php @@ -12,7 +12,8 @@ namespace AppBundle\Command; use AppBundle\Entity\User; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Doctrine\Common\Persistence\ManagerRegistry; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -32,15 +33,24 @@ * * @author Oleg Voronkovich */ -class DeleteUserCommand extends ContainerAwareCommand +class DeleteUserCommand extends Command { const MAX_ATTEMPTS = 5; + private $doctrine; + /** * @var ObjectManager */ private $entityManager; + public function __construct(ManagerRegistry $doctrine) + { + parent::__construct(); + + $this->doctrine = $doctrine; + } + /** * {@inheritdoc} */ @@ -65,7 +75,7 @@ protected function configure() protected function initialize(InputInterface $input, OutputInterface $output) { - $this->entityManager = $this->getContainer()->get('doctrine')->getManager(); + $this->entityManager = $this->doctrine->getManager(); } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/AppBundle/Controller/Admin/BlogController.php b/src/AppBundle/Controller/Admin/BlogController.php index e26a29ade..4f11f37d9 100644 --- a/src/AppBundle/Controller/Admin/BlogController.php +++ b/src/AppBundle/Controller/Admin/BlogController.php @@ -11,8 +11,10 @@ namespace AppBundle\Controller\Admin; -use Symfony\Component\HttpFoundation\Request; +use AppBundle\Utils\Slugger; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; +use Symfony\Component\HttpFoundation\Request; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; @@ -31,9 +33,17 @@ * * @author Ryan Weaver * @author Javier Eguiluz + * @author Kévin Dunglas */ class BlogController extends Controller { + private $slugger; + + public function __construct(Slugger $slugger) + { + $this->slugger = $slugger; + } + /** * Lists all Post entities. * @@ -83,7 +93,7 @@ public function newAction(Request $request) // However, we explicitly add it to improve code readability. // See http://symfony.com/doc/current/best_practices/forms.html#handling-form-submits if ($form->isSubmitted() && $form->isValid()) { - $post->setSlug($this->get('slugger')->slugify($post->getTitle())); + $post->setSlug($this->slugger->slugify($post->getTitle())); $entityManager = $this->getDoctrine()->getManager(); $entityManager->persist($post); @@ -151,7 +161,7 @@ public function editAction(Post $post, Request $request) $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { - $post->setSlug($this->get('slugger')->slugify($post->getTitle())); + $post->setSlug($this->slugger->slugify($post->getTitle())); $entityManager->flush(); $this->addFlash('success', 'post.updated_successfully'); diff --git a/src/AppBundle/Controller/BlogController.php b/src/AppBundle/Controller/BlogController.php index 520691025..55afcefff 100644 --- a/src/AppBundle/Controller/BlogController.php +++ b/src/AppBundle/Controller/BlogController.php @@ -13,6 +13,7 @@ use AppBundle\Entity\Comment; use AppBundle\Entity\Post; +use Knp\Component\Pager\PaginatorInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -29,9 +30,17 @@ * * @author Ryan Weaver * @author Javier Eguiluz + * @author Kévin Dunglas */ class BlogController extends Controller { + private $paginator; + + public function __construct(PaginatorInterface $paginator) // Typehint services you need here, they will be automatically autowired + { + $this->paginator = $paginator; + } + /** * @Route("/", defaults={"page": 1}, name="blog_index") * @Route("/page/{page}", requirements={"page": "[1-9]\d*"}, name="blog_index_paginated") @@ -42,8 +51,7 @@ public function indexAction($page) { $query = $this->getDoctrine()->getRepository('AppBundle:Post')->queryLatest(); - $paginator = $this->get('knp_paginator'); - $posts = $paginator->paginate($query, $page, Post::NUM_ITEMS); + $posts = $this->paginator->paginate($query, $page, Post::NUM_ITEMS); $posts->setUsedRoute('blog_index_paginated'); if (0 === count($posts)) { diff --git a/src/AppBundle/Controller/SecurityController.php b/src/AppBundle/Controller/SecurityController.php index 7e6203dbe..3a61fe6e7 100644 --- a/src/AppBundle/Controller/SecurityController.php +++ b/src/AppBundle/Controller/SecurityController.php @@ -11,9 +11,12 @@ namespace AppBundle\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; /** * Controller used to manage the application security. @@ -21,23 +24,31 @@ * * @author Ryan Weaver * @author Javier Eguiluz + * @author Kévin Dunglas */ -class SecurityController extends Controller +class SecurityController { + private $authenticationUtils; + private $twig; + + public function __construct(AuthenticationUtils $authenticationUtils, \Twig_Environment $twig) + { + $this->authenticationUtils = $authenticationUtils; + $this->twig = $twig; + } + /** * @Route("/login", name="security_login_form") * @Method("GET") */ public function loginAction() { - $helper = $this->get('security.authentication_utils'); - - return $this->render('security/login.html.twig', array( + return new Response($this->twig->render('security/login.html.twig', array( // last username entered by the user (if any) - 'last_username' => $helper->getLastUsername(), + 'last_username' => $this->authenticationUtils->getLastUsername(), // last authentication error (if any) - 'error' => $helper->getLastAuthenticationError(), - )); + 'error' => $this->authenticationUtils->getLastAuthenticationError(), + ))); } /** diff --git a/web/config.php b/web/config.php index cc030ad87..2e153097b 100644 --- a/web/config.php +++ b/web/config.php @@ -1,10 +1,23 @@ getFailedRecommendations(); ?> - - - Symfony Demo Application - - + + + Symfony Configuration Checker + + + + +
+
+ + +