Skip to content

Upgrade the Demo Application to Symfony 3.1 #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/app/config/parameters.yml
/app/bootstrap.php.cache
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/bin/
/composer.phar
web/bundles/whiteoctoberpagerfanta
/web/bundles/
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,4 +23,4 @@ install:
- composer install

script:
- phpunit -c app
- phpunit
15 changes: 15 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ public function registerBundles()
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(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
Expand Down
4 changes: 1 addition & 3 deletions app/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

error_reporting(error_reporting() & ~E_USER_DEPRECATED);

/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
AnnotationRegistry::registerLoader([$loader, 'loadClass']);

return $loader;
8 changes: 5 additions & 3 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ framework:
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
Expand Down Expand Up @@ -77,7 +77,9 @@ doctrine:
# them from the app/config/parameters.yml file. The reason is that config.yml
# stores options that change the application behavior and parameters.yml
# stores options that change from one server to another
url: "%database_url%"
driver: "pdo_sqlite"
# temp workaround for https://github.com/doctrine/dbal/issues/1106: define DB path here
path: "%kernel.root_dir%/../var/data/blog.sqlite"

orm:
auto_generate_proxy_classes: "%kernel.debug%"
Expand Down
2 changes: 1 addition & 1 deletion app/config/config_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ monolog:
handler: nested
nested:
type: stream
path: "php://stderr"
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
44 changes: 0 additions & 44 deletions app/phpunit.xml.dist

This file was deleted.

2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ install:

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- php phpunit.phar -c app --verbose
- php phpunit.phar --verbose
2 changes: 1 addition & 1 deletion app/console → bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set_time_limit(0);
/**
* @var Composer\Autoload\ClassLoader $loader
*/
$loader = require __DIR__.'/autoload.php';
$loader = require __DIR__.'/../app/autoload.php';

$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use a new array syntax. This converter can help you https://github.com/thomasbachem/php-short-array-syntax-converter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree ... but let's do that in a separate PR to not complicate this one too much. In fact, let's push PHP to use as many PHP 5.5 features as we can, not only the short array syntax.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand Down
3 changes: 2 additions & 1 deletion app/check.php → bin/symfony_requirements
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env php
<?php

require_once dirname(__FILE__).'/SymfonyRequirements.php';
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';

$lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
Expand Down
41 changes: 22 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
"require": {
"php" : ">=5.3.9",
"ext-pdo_sqlite" : "*",
"doctrine/doctrine-bundle" : "~1.5",
"doctrine/doctrine-fixtures-bundle" : "~2.2",
"doctrine/orm" : "~2.4",
"erusev/parsedown" : "~1.5",
"ezyang/htmlpurifier" : "~4.7",
"incenteev/composer-parameter-handler" : "~2.1",
"ircmaxell/password-compat" : "~1.0",
"leafo/scssphp" : "^0.4.0",
"patchwork/jsqueeze" : "~1.0",
"sensio/distribution-bundle" : "~5.0",
"sensio/framework-extra-bundle" : "~3.0",
"symfony/assetic-bundle" : "~2.6",
"symfony/monolog-bundle" : "~2.7",
"symfony/polyfill-intl-icu" : "^1.2",
"symfony/swiftmailer-bundle" : "~2.3",
"symfony/symfony" : "~2.8",
"twig/extensions" : "~1.2",
"doctrine/doctrine-bundle" : "^1.6",
"doctrine/doctrine-fixtures-bundle" : "^2.2",
"doctrine/orm" : "^2.5",
"erusev/parsedown" : "^1.5",
"ezyang/htmlpurifier" : "^4.7",
"incenteev/composer-parameter-handler" : "^2.0",
"ircmaxell/password-compat" : "^1.0",
"leafo/scssphp" : "^0.5",
"patchwork/jsqueeze" : "^2.0",
"sensio/distribution-bundle" : "^5.0",
"sensio/framework-extra-bundle" : "^3.0",
"symfony/assetic-bundle" : "^2.8",
"symfony/monolog-bundle" : "^2.8",
"symfony/swiftmailer-bundle" : "^2.3",
"symfony/symfony" : "^3.1",
"twig/extensions" : "^1.3",
"white-october/pagerfanta-bundle" : "^1.0"
},
"require-dev": {
"sensio/generator-bundle": "~3.0"
"sensio/generator-bundle" : "~3.0",
"symfony/phpunit-bridge" : "^3.0"
},
"scripts": {
"post-install-cmd": [
Expand All @@ -53,12 +53,15 @@
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.3.9"
"php": "5.5.9"
}
},
"extra": {
"symfony-app-dir": "app",
"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",
Expand Down
Loading