diff --git a/.travis.yml b/.travis.yml index 0e29c036b..7abec01fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,5 +36,7 @@ script: - ./bin/console lint:yaml @CodeExplorerBundle # this checks that the Twig template files contain no syntax errors - ./bin/console lint:twig app/Resources @CodeExplorerBundle + # this checks that the XLIFF translations contain no syntax errors + - ./bin/console lint:xliff app/Resources # this checks that the application doesn't use dependencies with known security vulnerabilities - ./bin/console security:check --end-point=http://security.sensiolabs.org/check_lock diff --git a/app/AppKernel.php b/app/AppKernel.php index 1ad4f6b3e..c0c4ad4b6 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -42,7 +42,11 @@ public function registerBundles() $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); - $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + + if ('dev' === $this->getEnvironment()) { + $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + } if ('test' === $this->getEnvironment()) { // this bundle makes it easier to work with databases in PHPUnit diff --git a/app/config/config.yml b/app/config/config.yml index 41c0a0047..15302787c 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -30,51 +30,50 @@ framework: # and with different cache configurations for each fragment # https://symfony.com/doc/current/book/http_cache.html#edge-side-includes esi: { enabled: true } - translator: { fallback: "%locale%" } - secret: "%env(SYMFONY_SECRET)%" + translator: { fallback: '%locale%' } + secret: '%env(SYMFONY_SECRET)%' router: - resource: "%kernel.root_dir%/config/routing.yml" + resource: '%kernel.root_dir%/config/routing.yml' strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } templating: engines: ['twig'] - default_locale: "%locale%" + default_locale: '%locale%' trusted_hosts: ~ - trusted_proxies: ~ session: handler_id: session.handler.native_file - save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%" + save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%' fragments: ~ http_method_override: true assets: ~ # Twig Configuration (used for rendering application templates) twig: - debug: "%kernel.debug%" - strict_variables: "%kernel.debug%" + debug: '%kernel.debug%' + strict_variables: '%kernel.debug%' form_themes: - - "form/layout.html.twig" - - "form/fields.html.twig" + - 'form/layout.html.twig' + - 'form/fields.html.twig' # Doctrine Configuration (used to access databases and manipulate their information) doctrine: dbal: # if you don't want to use SQLite, change the URL in parameters.yml or set the DATABASE_URL environment variable - url: "%env(DATABASE_URL)%" + url: '%env(DATABASE_URL)%' # instead of using a URL, you may also uncomment the following lines to configure your database # driver: pdo_mysql - # host: "%database_host%" - # port: "%database_port%" - # dbname: "%database_name%" - # user: "%database_user%" - # password: "%database_password%" + # host: '%database_host%' + # port: '%database_port%' + # dbname: '%database_name%' + # user: '%database_user%' + # password: '%database_password%' # charset: UTF8 orm: - auto_generate_proxy_classes: "%kernel.debug%" + auto_generate_proxy_classes: '%kernel.debug%' auto_mapping: true # Swiftmailer Configuration (used to send emails) @@ -84,8 +83,8 @@ doctrine: # stores options that change from one server to another # swiftmailer: - transport: "%mailer_transport%" - host: "%mailer_host%" - username: "%mailer_user%" - password: "%mailer_password%" + transport: '%mailer_transport%' + host: '%mailer_host%' + username: '%mailer_user%' + password: '%mailer_password%' spool: { type: memory } diff --git a/app/config/services.yml b/app/config/services.yml index d54d2b579..5da4664dc 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -1,83 +1,47 @@ services: - # First we define some basic services to make these utilities available in - # the entire application - slugger: - class: AppBundle\Utils\Slugger - - markdown: - class: AppBundle\Utils\Markdown - - # 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%'] - tags: - - { name: twig.extension } - - app.twig.intl_extension: - public: false - class: Twig_Extensions_Extension_Intl - tags: - - { name: twig.extension } - - # Defining a form type as a service is only required when the form type - # needs to use some other services, such as the entity manager. - # See https://symfony.com/doc/current/best_practices/forms.html - app.form.type.tagsinput: - class: AppBundle\Form\Type\TagsInputType - arguments: ['@doctrine.orm.entity_manager'] - tags: - - { name: form.type } - - # Event Listeners are classes that listen to one or more specific events. - # Those events are defined in the tags added to the service definition. - # See https://symfony.com/doc/current/event_dispatcher.html#creating-an-event-listener - app.redirect_to_preferred_locale_listener: - class: AppBundle\EventListener\RedirectToPreferredLocaleListener - arguments: ['@router', '%app_locales%', '%locale%'] - tags: - - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } - - app.comment_notification: - class: AppBundle\EventListener\CommentNotificationListener - arguments: ['@mailer', '@router', '@translator', '%app.notifications.email_sender%'] - # The "method" attribute of this tag is optional and defaults to "on + camelCasedEventName" - # If the event is "comment.created" the method executed by default is "onCommentCreated()". - tags: - - { name: kernel.event_listener, event: comment.created, method: onCommentCreated } - - # Event subscribers are similar to event listeners but they don't need service tags. - # Instead, the PHP class of the event subscriber includes a method that returns - # the list of events listened by that class. - # See https://symfony.com/doc/current/event_dispatcher.html#creating-an-event-subscriber - app.requirements_subscriber: - class: AppBundle\EventListener\CheckRequirementsSubscriber - arguments: ['@doctrine.orm.entity_manager'] - tags: - - { name: kernel.event_subscriber } - - # To inject the voter into the security layer, you must declare it as a service and tag it with security.voter. - # See https://symfony.com/doc/current/security/voters.html#configuring-the-voter - app.post_voter: - class: AppBundle\Security\PostVoter + # default configuration for services in *this* file + _defaults: + # automatically injects dependencies in your services + autowire: true + # automatically registers your services as commands, event subscribers, etc. + autoconfigure: true + # this means you cannot fetch services directly from the container via $container->get() + # if you need to do this, you can override this setting on individual services public: false - tags: - - { name: security.voter } - # Uncomment the following lines to define a service for the Post Doctrine repository. - # It's not mandatory to create these services, but if you use repositories a lot, - # these services simplify your code: - # - # app.post_repository: - # class: Doctrine\ORM\EntityRepository - # factory: ['@doctrine.orm.entity_manager', getRepository] - # arguments: [AppBundle\Entity\Post] - # - # // traditional code inside a controller - # $entityManager = $this->getDoctrine()->getManager(); - # $posts = $entityManager->getRepository('AppBundle:Post')->findAll(); - # - # // same code using repository services - # $posts = $this->get('app.post_repository')->findAll(); + # makes classes in src/AppBundle available to be used as services + # this creates a service per class whose id is the fully-qualified class name + AppBundle\: + resource: '../../src/AppBundle/*' + # you can exclude directories or files + # but if a service is unused, it's removed anyway + exclude: '../../src/AppBundle/{Controller,Entity,Repository}' + + # controllers are imported separately to make sure they're public + # and have a tag that allows actions to type-hint services + AppBundle\Controller\: + resource: '../../src/AppBundle/Controller' + public: true + tags: ['controller.service_arguments'] + + # Autowiring can't guess the constructor arguments that are not type-hinted with + # classes (e.g. container parameters) so you must define those arguments explicitly + AppBundle\Command\ListUsersCommand: + arguments: + $emailSender: '%app.notifications.email_sender%' + + AppBundle\Twig\AppExtension: + arguments: + $locales: '%app_locales%' + + AppBundle\EventListener\CommentNotificationSubscriber: + arguments: + $sender: '%app.notifications.email_sender%' + + AppBundle\EventListener\RedirectToPreferredLocaleSubscriber: + arguments: + $locales: '%app_locales%' + $defaultLocale: '%locale%' + + # needed for the localizeddate Twig filter + Twig\Extensions\IntlExtension: ~ diff --git a/composer.json b/composer.json index 51b395663..1de49445a 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ "symfony/monolog-bundle" : "^3.0", "symfony/polyfill-apcu" : "^1.0", "symfony/swiftmailer-bundle" : "^2.3", - "symfony/symfony" : "^3.2", - "twig/extensions" : "^1.3", + "symfony/symfony" : "^3.3", + "twig/extensions" : "^1.5", "twig/twig" : "^1.28 || ^2.0", "white-october/pagerfanta-bundle" : "^1.0" }, diff --git a/composer.lock b/composer.lock index 59bb0aa16..cf8759aa4 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": "a201a8d92585c751f757f88752195add", + "content-hash": "746cbb988fffb23fbb88c44470958d5d", "packages": [ { "name": "composer/ca-bundle", @@ -472,37 +472,37 @@ }, { "name": "doctrine/doctrine-bundle", - "version": "1.6.7", + "version": "1.6.8", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "a01d99bc6c9a6c8a8ace0012690099dd957ce9b9" + "reference": "6e96577cbbdbb5b6dcca2ff203d665976b51beb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/a01d99bc6c9a6c8a8ace0012690099dd957ce9b9", - "reference": "a01d99bc6c9a6c8a8ace0012690099dd957ce9b9", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/6e96577cbbdbb5b6dcca2ff203d665976b51beb0", + "reference": "6e96577cbbdbb5b6dcca2ff203d665976b51beb0", "shasum": "" }, "require": { "doctrine/dbal": "~2.3", - "doctrine/doctrine-cache-bundle": "~1.0", + "doctrine/doctrine-cache-bundle": "~1.2", "jdorn/sql-formatter": "~1.1", "php": ">=5.5.9", - "symfony/console": "~2.7|~3.0", - "symfony/dependency-injection": "~2.7|~3.0", - "symfony/doctrine-bridge": "~2.7|~3.0", - "symfony/framework-bundle": "~2.7|~3.0" + "symfony/console": "~2.7|~3.0|~4.0", + "symfony/dependency-injection": "~2.7|~3.0|~4.0", + "symfony/doctrine-bridge": "~2.7|~3.0|~4.0", + "symfony/framework-bundle": "~2.7|~3.0|~4.0" }, "require-dev": { "doctrine/orm": "~2.3", "phpunit/phpunit": "~4", "satooshi/php-coveralls": "^1.0", - "symfony/phpunit-bridge": "~2.7|~3.0", - "symfony/property-info": "~2.8|~3.0", - "symfony/validator": "~2.7|~3.0", - "symfony/yaml": "~2.7|~3.0", - "twig/twig": "~1.10|~2.0" + "symfony/phpunit-bridge": "~2.7|~3.0|~4.0", + "symfony/property-info": "~2.8|~3.0|~4.0", + "symfony/validator": "~2.7|~3.0|~4.0", + "symfony/yaml": "~2.7|~3.0|~4.0", + "twig/twig": "~1.12|~2.0" }, "suggest": { "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", @@ -549,7 +549,7 @@ "orm", "persistence" ], - "time": "2017-01-16T12:01:26+00:00" + "time": "2017-05-18T08:15:18+00:00" }, { "name": "doctrine/doctrine-cache-bundle", @@ -1036,6 +1036,60 @@ ], "time": "2017-03-13T06:30:53+00:00" }, + { + "name": "fig/link-util", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link-util.git", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link-util/zipball/1a07821801a148be4add11ab0603e4af55a72fac", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/link": "~1.0@dev" + }, + "require-dev": { + "phpunit/phpunit": "^5.1", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common utility implementations for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-17T18:31:11+00:00" + }, { "name": "incenteev/composer-parameter-handler", "version": "v2.1.2", @@ -1378,6 +1432,104 @@ ], "time": "2016-08-06T20:24:11+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/link", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link.git", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-28T16:06:13+00:00" + }, { "name": "psr/log", "version": "1.0.2", @@ -1425,18 +1577,66 @@ ], "time": "2016-10-10T12:19:37+00:00" }, + { + "name": "psr/simple-cache", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-01-02T13:31:39+00:00" + }, { "name": "sensio/distribution-bundle", - "version": "v5.0.19", + "version": "v5.0.20", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "654c4fa3d11448c8005400a244987896243a990a" + "reference": "4b019d4c0bd64438c42e4b6b0726085b409be8d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/654c4fa3d11448c8005400a244987896243a990a", - "reference": "654c4fa3d11448c8005400a244987896243a990a", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/4b019d4c0bd64438c42e4b6b0726085b409be8d9", + "reference": "4b019d4c0bd64438c42e4b6b0726085b409be8d9", "shasum": "" }, "require": { @@ -1475,20 +1675,20 @@ "configuration", "distribution" ], - "time": "2017-04-23T22:28:23+00:00" + "time": "2017-05-11T16:21:03+00:00" }, { "name": "sensio/framework-extra-bundle", - "version": "v3.0.25", + "version": "v3.0.26", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "472b339cf0c82f3a033b29f85d9d9cada3cd1a9c" + "reference": "6d6cbe971554f0a2cc84965850481eb04a2a0059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/472b339cf0c82f3a033b29f85d9d9cada3cd1a9c", - "reference": "472b339cf0c82f3a033b29f85d9d9cada3cd1a9c", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/6d6cbe971554f0a2cc84965850481eb04a2a0059", + "reference": "6d6cbe971554f0a2cc84965850481eb04a2a0059", "shasum": "" }, "require": { @@ -1545,7 +1745,7 @@ "annotations", "controllers" ], - "time": "2017-03-21T23:34:44+00:00" + "time": "2017-05-11T17:01:57+00:00" }, { "name": "sensiolabs/security-checker", @@ -2045,21 +2245,21 @@ }, { "name": "symfony/swiftmailer-bundle", - "version": "v2.5.4", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/symfony/swiftmailer-bundle.git", - "reference": "8ab32ce31a7156621fb92e0466586186beb89759" + "reference": "deabc81120c2086571f7c4484ab785c5e1b84f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/8ab32ce31a7156621fb92e0466586186beb89759", - "reference": "8ab32ce31a7156621fb92e0466586186beb89759", + "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/deabc81120c2086571f7c4484ab785c5e1b84f75", + "reference": "deabc81120c2086571f7c4484ab785c5e1b84f75", "shasum": "" }, "require": { "php": ">=5.3.2", - "swiftmailer/swiftmailer": ">=4.2.0,~5.0", + "swiftmailer/swiftmailer": "~4.2|~5.0", "symfony/config": "~2.7|~3.0", "symfony/dependency-injection": "~2.7|~3.0", "symfony/http-kernel": "~2.7|~3.0" @@ -2067,7 +2267,7 @@ "require-dev": { "symfony/console": "~2.7|~3.0", "symfony/framework-bundle": "~2.7|~3.0", - "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/phpunit-bridge": "~3.3@dev", "symfony/yaml": "~2.7|~3.0" }, "suggest": { @@ -2076,7 +2276,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2100,33 +2300,37 @@ ], "description": "Symfony SwiftmailerBundle", "homepage": "http://symfony.com", - "time": "2017-03-21T21:47:36+00:00" + "time": "2017-05-22T04:58:24+00:00" }, { "name": "symfony/symfony", - "version": "v3.2.8", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "85959c2abbe4d2f050f950f39c9c3cf83819f3df" + "reference": "5a7e31c48e7cd4831efa409fffb661beb9995174" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/85959c2abbe4d2f050f950f39c9c3cf83819f3df", - "reference": "85959c2abbe4d2f050f950f39c9c3cf83819f3df", + "url": "https://api.github.com/repos/symfony/symfony/zipball/5a7e31c48e7cd4831efa409fffb661beb9995174", + "reference": "5a7e31c48e7cd4831efa409fffb661beb9995174", "shasum": "" }, "require": { "doctrine/common": "~2.4", + "fig/link-util": "^1.0", "php": ">=5.5.9", "psr/cache": "~1.0", + "psr/container": "^1.0", + "psr/link": "^1.0", "psr/log": "~1.0", + "psr/simple-cache": "^1.0", "symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php56": "~1.0", "symfony/polyfill-php70": "~1.0", "symfony/polyfill-util": "~1.0", - "twig/twig": "~1.28|~2.0" + "twig/twig": "~1.32|~2.2" }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0", @@ -2134,7 +2338,9 @@ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "provide": { - "psr/cache-implementation": "1.0" + "psr/cache-implementation": "1.0", + "psr/container-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" }, "replace": { "symfony/asset": "self.version", @@ -2149,6 +2355,7 @@ "symfony/dependency-injection": "self.version", "symfony/doctrine-bridge": "self.version", "symfony/dom-crawler": "self.version", + "symfony/dotenv": "self.version", "symfony/event-dispatcher": "self.version", "symfony/expression-language": "self.version", "symfony/filesystem": "self.version", @@ -2181,7 +2388,9 @@ "symfony/twig-bundle": "self.version", "symfony/validator": "self.version", "symfony/var-dumper": "self.version", + "symfony/web-link": "self.version", "symfony/web-profiler-bundle": "self.version", + "symfony/web-server-bundle": "self.version", "symfony/workflow": "self.version", "symfony/yaml": "self.version" }, @@ -2205,7 +2414,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -2244,27 +2453,28 @@ "keywords": [ "framework" ], - "time": "2017-05-01T17:47:03+00:00" + "time": "2017-05-29T21:02:32+00:00" }, { "name": "twig/extensions", - "version": "v1.4.1", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig-extensions.git", - "reference": "f0bb8431c8691f5a39f1017d9a5967a082bf01ff" + "reference": "d6d74d6f3213a9574c460c4390c25a1a67c17cc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/f0bb8431c8691f5a39f1017d9a5967a082bf01ff", - "reference": "f0bb8431c8691f5a39f1017d9a5967a082bf01ff", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/d6d74d6f3213a9574c460c4390c25a1a67c17cc3", + "reference": "d6d74d6f3213a9574c460c4390c25a1a67c17cc3", "shasum": "" }, "require": { - "twig/twig": "~1.20|~2.0" + "twig/twig": "~1.27|~2.0" }, "require-dev": { - "symfony/translation": "~2.3" + "symfony/phpunit-bridge": "~3.3@dev", + "symfony/translation": "~2.3|~3.0" }, "suggest": { "symfony/translation": "Allow the time_diff output to be translated" @@ -2272,12 +2482,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { "psr-0": { "Twig_Extensions_": "lib/" + }, + "psr-4": { + "Twig\\Extensions\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2296,7 +2509,7 @@ "i18n", "text" ], - "time": "2016-10-25T17:34:14+00:00" + "time": "2017-05-24T06:24:07+00:00" }, { "name": "twig/twig", @@ -2470,21 +2683,23 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.2.3", + "version": "v2.2.4", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "8f33cf3da0da94b67b9cd696b2b9dda81c928f72" + "reference": "5191e01d0fa0f579eb709350306cd11ad6427ca6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/8f33cf3da0da94b67b9cd696b2b9dda81c928f72", - "reference": "8f33cf3da0da94b67b9cd696b2b9dda81c928f72", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5191e01d0fa0f579eb709350306cd11ad6427ca6", + "reference": "5191e01d0fa0f579eb709350306cd11ad6427ca6", "shasum": "" }, "require": { "doctrine/annotations": "^1.2", + "ext-json": "*", "ext-tokenizer": "*", + "gecko-packages/gecko-php-unit": "^2.0", "php": "^5.3.6 || >=7.0 <7.2", "sebastian/diff": "^1.4", "symfony/console": "^2.4 || ^3.0", @@ -2503,9 +2718,9 @@ "hhvm": "<3.18" }, "require-dev": { - "gecko-packages/gecko-php-unit": "^2.0", + "johnkary/phpunit-speedtrap": "^1.0.1", "justinrainbow/json-schema": "^5.0", - "phpunit/phpunit": "^4.5 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.4.3", "satooshi/php-coveralls": "^1.0", "symfony/phpunit-bridge": "^3.2.2" }, @@ -2543,7 +2758,46 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-04-25T20:39:28+00:00" + "time": "2017-05-24T21:55:27+00:00" + }, + { + "name": "gecko-packages/gecko-php-unit", + "version": "v2.0", + "source": { + "type": "git", + "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", + "reference": "40a697ec261f3526e8196363b481b24383740c13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/40a697ec261f3526e8196363b481b24383740c13", + "reference": "40a697ec261f3526e8196363b481b24383740c13", + "shasum": "" + }, + "require": { + "php": "^5.3.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "GeckoPackages\\PHPUnit\\": "src\\PHPUnit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Additional PHPUnit tests.", + "homepage": "https://github.com/GeckoPackages", + "keywords": [ + "extension", + "filesystem", + "phpunit" + ], + "time": "2016-11-22T11:01:27+00:00" }, { "name": "ircmaxell/password-compat", @@ -3238,23 +3492,23 @@ }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -3286,7 +3540,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -3600,23 +3854,23 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v3.2.8", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "00916603c524b8048906de460b7ea0dfa1651281" + "reference": "1a09124ea479cca85fc66a6f21e59aa952ebed1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/00916603c524b8048906de460b7ea0dfa1651281", - "reference": "00916603c524b8048906de460b7ea0dfa1651281", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/1a09124ea479cca85fc66a6f21e59aa952ebed1f", + "reference": "1a09124ea479cca85fc66a6f21e59aa952ebed1f", "shasum": "" }, "require": { "php": ">=5.3.3" }, "conflict": { - "phpunit/phpunit": ">=6.0" + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "suggest": { "ext-zip": "Zip support is required when using bin/simple-phpunit", @@ -3628,7 +3882,7 @@ "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -3658,7 +3912,7 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "time": "2017-04-12T14:13:17+00:00" + "time": "2017-05-28T11:10:04+00:00" }, { "name": "symfony/polyfill-php54", diff --git a/src/AppBundle/Command/AddUserCommand.php b/src/AppBundle/Command/AddUserCommand.php index 0cfa0c3f3..e1e8050f0 100644 --- a/src/AppBundle/Command/AddUserCommand.php +++ b/src/AppBundle/Command/AddUserCommand.php @@ -12,13 +12,14 @@ namespace AppBundle\Command; use AppBundle\Entity\User; -use Doctrine\Common\Persistence\ObjectManager; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; +use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder; /** * A command console that creates users and stores them in the database. @@ -39,14 +40,20 @@ * @author Javier Eguiluz * @author Yonel Ceruto */ -class AddUserCommand extends ContainerAwareCommand +class AddUserCommand extends Command { const MAX_ATTEMPTS = 5; - /** - * @var ObjectManager - */ private $entityManager; + private $passwordEncoder; + + public function __construct(EntityManagerInterface $em, UserPasswordEncoder $encoder) + { + parent::__construct(); + + $this->entityManager = $em; + $this->passwordEncoder = $encoder; + } /** * {@inheritdoc} @@ -68,19 +75,6 @@ protected function configure() ; } - /** - * This method is executed before the interact() and the execute() methods. - * It's main purpose is to initialize the variables used in the rest of the - * command methods. - * - * Beware that the input options and arguments are validated after executing - * the interact() method, so you can't blindly trust their values in this method. - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - $this->entityManager = $this->getContainer()->get('doctrine')->getManager(); - } - /** * This method is executed after initialize() and before execute(). Its purpose * is to check if some of the options/arguments are missing and interactively @@ -206,8 +200,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $user->setRoles([$isAdmin ? 'ROLE_ADMIN' : 'ROLE_USER']); // See https://symfony.com/doc/current/book/security.html#security-encoding-password - $encoder = $this->getContainer()->get('security.password_encoder'); - $encodedPassword = $encoder->encodePassword($user, $plainPassword); + $encodedPassword = $this->passwordEncoder->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 bf8e09c86..9e3c8eaf7 100644 --- a/src/AppBundle/Command/DeleteUserCommand.php +++ b/src/AppBundle/Command/DeleteUserCommand.php @@ -12,8 +12,8 @@ namespace AppBundle\Command; use AppBundle\Entity\User; -use Doctrine\Common\Persistence\ObjectManager; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -36,15 +36,19 @@ * * @author Oleg Voronkovich */ -class DeleteUserCommand extends ContainerAwareCommand +class DeleteUserCommand extends Command { const MAX_ATTEMPTS = 5; - /** - * @var ObjectManager - */ private $entityManager; + public function __construct(EntityManagerInterface $em) + { + parent::__construct(); + + $this->entityManager = $em; + } + /** * {@inheritdoc} */ @@ -67,11 +71,6 @@ protected function configure() ); } - protected function initialize(InputInterface $input, OutputInterface $output) - { - $this->entityManager = $this->getContainer()->get('doctrine')->getManager(); - } - protected function interact(InputInterface $input, OutputInterface $output) { if (null !== $input->getArgument('username')) { diff --git a/src/AppBundle/Command/ListUsersCommand.php b/src/AppBundle/Command/ListUsersCommand.php index 327a3b65c..f19791762 100644 --- a/src/AppBundle/Command/ListUsersCommand.php +++ b/src/AppBundle/Command/ListUsersCommand.php @@ -12,8 +12,8 @@ namespace AppBundle\Command; use AppBundle\Entity\User; -use Doctrine\Common\Persistence\ObjectManager; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -34,12 +34,20 @@ * * @author Javier Eguiluz */ -class ListUsersCommand extends ContainerAwareCommand +class ListUsersCommand extends Command { - /** - * @var ObjectManager - */ private $entityManager; + private $mailer; + private $emailSender; + + public function __construct(EntityManagerInterface $em, \Swift_Mailer $mailer, $emailSender) + { + parent::__construct(); + + $this->entityManager = $em; + $this->mailer = $mailer; + $this->emailSender = $emailSender; + } /** * {@inheritdoc} @@ -74,15 +82,6 @@ protected function configure() ; } - /** - * This method is executed before the the execute() method. It's main purpose - * is to initialize the variables used in the rest of the command methods. - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - $this->entityManager = $this->getContainer()->get('doctrine')->getManager(); - } - /** * This method is executed after initialize(). It usually contains the logic * to execute to complete this command task. @@ -133,15 +132,13 @@ protected function execute(InputInterface $input, OutputInterface $output) private function sendReport($contents, $recipient) { // See https://symfony.com/doc/current/cookbook/email/email.html - $mailer = $this->getContainer()->get('mailer'); - - $message = $mailer->createMessage() + $message = $this->mailer->createMessage() ->setSubject(sprintf('app:list-users report (%s)', date('Y-m-d H:i:s'))) - ->setFrom($this->getContainer()->getParameter('app.notifications.email_sender')) + ->setFrom($this->emailSender) ->setTo($recipient) ->setBody($contents, 'text/plain') ; - $mailer->send($message); + $this->mailer->send($message); } } diff --git a/src/AppBundle/Controller/Admin/BlogController.php b/src/AppBundle/Controller/Admin/BlogController.php index 7a0bb9f42..ceffe9372 100644 --- a/src/AppBundle/Controller/Admin/BlogController.php +++ b/src/AppBundle/Controller/Admin/BlogController.php @@ -13,6 +13,7 @@ use AppBundle\Entity\Post; use AppBundle\Form\PostType; +use AppBundle\Utils\Slugger; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; @@ -54,8 +55,8 @@ class BlogController extends Controller */ public function indexAction() { - $entityManager = $this->getDoctrine()->getManager(); - $posts = $entityManager->getRepository(Post::class)->findBy(['author' => $this->getUser()], ['publishedAt' => 'DESC']); + $em = $this->getDoctrine()->getManager(); + $posts = $em->getRepository(Post::class)->findBy(['author' => $this->getUser()], ['publishedAt' => 'DESC']); return $this->render('admin/blog/index.html.twig', ['posts' => $posts]); } @@ -70,7 +71,7 @@ public function indexAction() * to constraint the HTTP methods each controller responds to (by default * it responds to all methods). */ - public function newAction(Request $request) + public function newAction(Request $request, Slugger $slugger) { $post = new Post(); $post->setAuthor($this->getUser()); @@ -86,11 +87,11 @@ public function newAction(Request $request) // However, we explicitly add it to improve code readability. // See https://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($slugger->slugify($post->getTitle())); - $entityManager = $this->getDoctrine()->getManager(); - $entityManager->persist($post); - $entityManager->flush(); + $em = $this->getDoctrine()->getManager(); + $em->persist($post); + $em->flush(); // Flash messages are used to notify the user about the result of the // actions. They are deleted automatically from the session as soon @@ -134,19 +135,16 @@ public function showAction(Post $post) * @Route("/{id}/edit", requirements={"id": "\d+"}, name="admin_post_edit") * @Method({"GET", "POST"}) */ - public function editAction(Post $post, Request $request) + public function editAction(Request $request, Post $post, Slugger $slugger) { $this->denyAccessUnlessGranted('edit', $post, 'Posts can only be edited by their authors.'); - $entityManager = $this->getDoctrine()->getManager(); - $form = $this->createForm(PostType::class, $post); - $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $post->setSlug($this->get('slugger')->slugify($post->getTitle())); - $entityManager->flush(); + $post->setSlug($slugger->slugify($post->getTitle())); + $this->getDoctrine()->getManager()->flush(); $this->addFlash('success', 'post.updated_successfully'); @@ -175,15 +173,14 @@ public function deleteAction(Request $request, Post $post) return $this->redirectToRoute('admin_post_index'); } - $entityManager = $this->getDoctrine()->getManager(); - // Delete the tags associated with this blog post. This is done automatically // by Doctrine, except for SQLite (the database used in this application) // because foreign key support is not enabled by default in SQLite $post->getTags()->clear(); - $entityManager->remove($post); - $entityManager->flush(); + $em = $this->getDoctrine()->getManager(); + $em->remove($post); + $em->flush(); $this->addFlash('success', 'post.deleted_successfully'); diff --git a/src/AppBundle/Controller/BlogController.php b/src/AppBundle/Controller/BlogController.php index 38c42b03c..7bce8958f 100644 --- a/src/AppBundle/Controller/BlogController.php +++ b/src/AppBundle/Controller/BlogController.php @@ -21,6 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -48,7 +49,8 @@ class BlogController extends Controller */ public function indexAction($page, $_format) { - $posts = $this->getDoctrine()->getRepository(Post::class)->findLatest($page); + $em = $this->getDoctrine()->getManager(); + $posts = $em->getRepository(Post::class)->findLatest($page); // Every template name also has two extensions that specify the format and // engine for that template. @@ -74,7 +76,7 @@ public function postShowAction(Post $post) // This function can be used both in PHP files and Twig templates. The only // requirement is to have enabled the DebugBundle. if ('dev' === $this->getParameter('kernel.environment')) { - dump($post, $this->get('security.token_storage')->getToken()->getUser(), new \DateTime()); + dump($post, $this->getUser(), new \DateTime()); } return $this->render('blog/post_show.html.twig', ['post' => $post]); @@ -90,21 +92,19 @@ public function postShowAction(Post $post) * (postSlug) doesn't match any of the Doctrine entity properties (slug). * See https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#doctrine-converter */ - public function commentNewAction(Request $request, Post $post) + public function commentNewAction(Request $request, Post $post, EventDispatcherInterface $eventDispatcher) { $comment = new Comment(); $comment->setAuthor($this->getUser()); - $post->addComment($comment); $form = $this->createForm(CommentType::class, $comment); - $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $entityManager = $this->getDoctrine()->getManager(); - $entityManager->persist($comment); - $entityManager->flush(); + $em = $this->getDoctrine()->getManager(); + $em->persist($comment); + $em->flush(); // When triggering an event, you can optionally pass some information. // For simple applications, use the GenericEvent object provided by Symfony @@ -118,7 +118,7 @@ public function commentNewAction(Request $request, Post $post) // passed in the event and they can even modify the execution flow, so // there's no guarantee that the rest of this controller will be executed. // See https://symfony.com/doc/current/components/event_dispatcher.html - $this->get('event_dispatcher')->dispatch(Events::COMMENT_CREATED, $event); + $eventDispatcher->dispatch(Events::COMMENT_CREATED, $event); return $this->redirectToRoute('blog_post', ['slug' => $post->getSlug()]); } diff --git a/src/AppBundle/Controller/SecurityController.php b/src/AppBundle/Controller/SecurityController.php index c5d304c63..cb2770e68 100644 --- a/src/AppBundle/Controller/SecurityController.php +++ b/src/AppBundle/Controller/SecurityController.php @@ -13,6 +13,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; /** * Controller used to manage the application security. @@ -26,10 +27,8 @@ class SecurityController extends Controller /** * @Route("/login", name="security_login") */ - public function loginAction() + public function loginAction(AuthenticationUtils $helper) { - $helper = $this->get('security.authentication_utils'); - return $this->render('security/login.html.twig', [ // last username entered by the user (if any) 'last_username' => $helper->getLastUsername(), diff --git a/src/AppBundle/EventListener/CommentNotificationListener.php b/src/AppBundle/EventListener/CommentNotificationSubscriber.php similarity index 90% rename from src/AppBundle/EventListener/CommentNotificationListener.php rename to src/AppBundle/EventListener/CommentNotificationSubscriber.php index 93b521906..8ae7de977 100644 --- a/src/AppBundle/EventListener/CommentNotificationListener.php +++ b/src/AppBundle/EventListener/CommentNotificationSubscriber.php @@ -12,6 +12,8 @@ namespace AppBundle\EventListener; use AppBundle\Entity\Comment; +use AppBundle\Events; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -21,7 +23,7 @@ * * @author Oleg Voronkovich */ -class CommentNotificationListener +class CommentNotificationSubscriber implements EventSubscriberInterface { /** * @var \Swift_Mailer @@ -59,6 +61,13 @@ public function __construct(\Swift_Mailer $mailer, UrlGeneratorInterface $urlGen $this->sender = $sender; } + public static function getSubscribedEvents() + { + return [ + Events::COMMENT_CREATED => 'onCommentCreated', + ]; + } + /** * @param GenericEvent $event */ diff --git a/src/AppBundle/EventListener/RedirectToPreferredLocaleListener.php b/src/AppBundle/EventListener/RedirectToPreferredLocaleSubscriber.php similarity index 90% rename from src/AppBundle/EventListener/RedirectToPreferredLocaleListener.php rename to src/AppBundle/EventListener/RedirectToPreferredLocaleSubscriber.php index 35b5c2745..2d95dc25e 100644 --- a/src/AppBundle/EventListener/RedirectToPreferredLocaleListener.php +++ b/src/AppBundle/EventListener/RedirectToPreferredLocaleSubscriber.php @@ -11,8 +11,10 @@ namespace AppBundle\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** @@ -23,7 +25,7 @@ * * @author Oleg Voronkovich */ -class RedirectToPreferredLocaleListener +class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterface { /** * @var UrlGeneratorInterface @@ -71,6 +73,13 @@ public function __construct(UrlGeneratorInterface $urlGenerator, $locales, $defa $this->locales = array_unique($this->locales); } + public static function getSubscribedEvents() + { + return [ + KernelEvents::REQUEST => 'onKernelRequest', + ]; + } + /** * @param GetResponseEvent $event */ diff --git a/src/AppBundle/Form/Type/DateTimePickerType.php b/src/AppBundle/Form/Type/DateTimePickerType.php index 0c54dd89e..d1f8d996e 100644 --- a/src/AppBundle/Form/Type/DateTimePickerType.php +++ b/src/AppBundle/Form/Type/DateTimePickerType.php @@ -30,9 +30,9 @@ class DateTimePickerType extends AbstractType { private $formatConverter; - public function __construct() + public function __construct(MomentFormatConverter $converter) { - $this->formatConverter = new MomentFormatConverter(); + $this->formatConverter = $converter; } /** diff --git a/tests/AppBundle/Command/AddUserCommandTest.php b/tests/AppBundle/Command/AddUserCommandTest.php index 6424f98cb..6c67f0619 100644 --- a/tests/AppBundle/Command/AddUserCommandTest.php +++ b/tests/AppBundle/Command/AddUserCommandTest.php @@ -103,7 +103,8 @@ private function executeCommand(array $arguments, array $inputs = []) { self::bootKernel(); - $command = new AddUserCommand(); + $container = self::$kernel->getContainer(); + $command = new AddUserCommand($container->get('doctrine')->getManager(), $container->get('security.password_encoder')); $command->setApplication(new Application(self::$kernel)); $commandTester = new CommandTester($command); diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php index 7e7a99de9..3b14a4022 100644 --- a/var/SymfonyRequirements.php +++ b/var/SymfonyRequirements.php @@ -633,12 +633,6 @@ function_exists('mb_strlen'), 'Install and enable the mbstring extension.' ); - $this->addRecommendation( - function_exists('iconv'), - 'iconv() should be available', - 'Install and enable the iconv extension.' - ); - $this->addRecommendation( function_exists('utf8_decode'), 'utf8_decode() should be available', diff --git a/web/config.php b/web/config.php index 69df43cf7..fd7e17e6b 100644 --- a/web/config.php +++ b/web/config.php @@ -11,7 +11,7 @@ */ if (!isset($_SERVER['HTTP_HOST'])) { - exit('This script cannot be run from the CLI. Run it from a browser.'); + exit("This script cannot be run from the CLI. Run it from a browser.\n"); } if (!in_array(@$_SERVER['REMOTE_ADDR'], array(