Skip to content

Commit 56cfa66

Browse files
committed
Upgrade the Demo Application to Symfony 3.1
1 parent 3ca2b94 commit 56cfa66

19 files changed

+364
-421
lines changed

.gitignore

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
/app/config/parameters.yml
2-
/app/bootstrap.php.cache
3-
/app/cache/*
4-
/app/logs/*
5-
!app/cache/.gitkeep
6-
!app/logs/.gitkeep
72
/build/
3+
/phpunit.xml
4+
/var/*
5+
!/var/cache
6+
/var/cache/*
7+
!var/cache/.gitkeep
8+
!/var/logs
9+
/var/logs/*
10+
!var/logs/.gitkeep
11+
!/var/sessions
12+
/var/sessions/*
13+
!var/sessions/.gitkeep
14+
!var/SymfonyRequirements.php
815
/vendor/
9-
/bin/
10-
/composer.phar
11-
web/bundles/whiteoctoberpagerfanta
16+
/web/bundles/

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ cache:
88
matrix:
99
fast_finish: true
1010
include:
11-
- php: 5.3
12-
- php: 5.4
1311
- php: 5.5
1412
- php: 5.6
1513
- php: 7.0
@@ -25,4 +23,4 @@ install:
2523
- composer install
2624

2725
script:
28-
- phpunit -c app
26+
- phpunit

app/AppKernel.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ public function registerBundles()
4040
return $bundles;
4141
}
4242

43+
public function getRootDir()
44+
{
45+
return __DIR__;
46+
}
47+
48+
public function getCacheDir()
49+
{
50+
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
51+
}
52+
53+
public function getLogDir()
54+
{
55+
return dirname(__DIR__).'/var/logs';
56+
}
57+
4358
public function registerContainerConfiguration(LoaderInterface $loader)
4459
{
4560
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');

app/autoload.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
use Doctrine\Common\Annotations\AnnotationRegistry;
44
use Composer\Autoload\ClassLoader;
55

6-
error_reporting(error_reporting() & ~E_USER_DEPRECATED);
7-
86
/**
97
* @var ClassLoader $loader
108
*/
119
$loader = require __DIR__.'/../vendor/autoload.php';
1210

13-
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
11+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
1412

1513
return $loader;

app/config/config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ framework:
4444
trusted_hosts: ~
4545
trusted_proxies: ~
4646
session:
47-
# handler_id set to null will use default session handler from php.ini
48-
handler_id: ~
47+
handler_id: session.handler.native_file
48+
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
4949
fragments: ~
5050
http_method_override: true
5151
assets: ~
@@ -77,7 +77,9 @@ doctrine:
7777
# them from the app/config/parameters.yml file. The reason is that config.yml
7878
# stores options that change the application behavior and parameters.yml
7979
# stores options that change from one server to another
80-
url: "%database_url%"
80+
driver: "pdo_sqlite"
81+
# temp workaround for https://github.com/doctrine/dbal/issues/1106: define DB path here
82+
path: "%kernel.root_dir%/../var/data/blog.sqlite"
8183

8284
orm:
8385
auto_generate_proxy_classes: "%kernel.debug%"

app/config/config_prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ monolog:
2121
handler: nested
2222
nested:
2323
type: stream
24-
path: "php://stderr"
24+
path: "%kernel.logs_dir%/%kernel.environment%.log"
2525
level: debug
2626
console:
2727
type: console

app/phpunit.xml.dist

Lines changed: 0 additions & 44 deletions
This file was deleted.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ install:
2727

2828
test_script:
2929
- cd %APPVEYOR_BUILD_FOLDER%
30-
- php phpunit.phar -c app --verbose
30+
- php phpunit.phar --verbose

app/console renamed to bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set_time_limit(0);
1414
/**
1515
* @var Composer\Autoload\ClassLoader $loader
1616
*/
17-
$loader = require __DIR__.'/autoload.php';
17+
$loader = require __DIR__.'/../app/autoload.php';
1818

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

app/check.php renamed to bin/symfony_requirements

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#!/usr/bin/env php
12
<?php
23

3-
require_once dirname(__FILE__).'/SymfonyRequirements.php';
4+
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
45

56
$lineSize = 70;
67
$symfonyRequirements = new SymfonyRequirements();

composer.json

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010
"require": {
1111
"php" : ">=5.3.9",
1212
"ext-pdo_sqlite" : "*",
13-
"doctrine/doctrine-bundle" : "~1.5",
14-
"doctrine/doctrine-fixtures-bundle" : "~2.2",
15-
"doctrine/orm" : "~2.4",
16-
"erusev/parsedown" : "~1.5",
17-
"ezyang/htmlpurifier" : "~4.7",
18-
"incenteev/composer-parameter-handler" : "~2.1",
19-
"ircmaxell/password-compat" : "~1.0",
20-
"leafo/scssphp" : "^0.4.0",
21-
"patchwork/jsqueeze" : "~1.0",
22-
"sensio/distribution-bundle" : "~5.0",
23-
"sensio/framework-extra-bundle" : "~3.0",
24-
"symfony/assetic-bundle" : "~2.6",
25-
"symfony/monolog-bundle" : "~2.7",
26-
"symfony/polyfill-intl-icu" : "^1.2",
27-
"symfony/swiftmailer-bundle" : "~2.3",
28-
"symfony/symfony" : "~2.8",
29-
"twig/extensions" : "~1.2",
13+
"doctrine/doctrine-bundle" : "^1.6",
14+
"doctrine/doctrine-fixtures-bundle" : "^2.2",
15+
"doctrine/orm" : "^2.5",
16+
"erusev/parsedown" : "^1.5",
17+
"ezyang/htmlpurifier" : "^4.7",
18+
"incenteev/composer-parameter-handler" : "^2.0",
19+
"ircmaxell/password-compat" : "^1.0",
20+
"leafo/scssphp" : "^0.5",
21+
"patchwork/jsqueeze" : "^2.0",
22+
"sensio/distribution-bundle" : "^5.0",
23+
"sensio/framework-extra-bundle" : "^3.0",
24+
"symfony/assetic-bundle" : "^2.8",
25+
"symfony/monolog-bundle" : "^2.8",
26+
"symfony/swiftmailer-bundle" : "^2.3",
27+
"symfony/symfony" : "^3.1",
28+
"twig/extensions" : "^1.3",
3029
"white-october/pagerfanta-bundle" : "^1.0"
3130
},
3231
"require-dev": {
33-
"sensio/generator-bundle": "~3.0"
32+
"sensio/generator-bundle" : "~3.0",
33+
"symfony/phpunit-bridge" : "^3.0"
3434
},
3535
"scripts": {
3636
"post-install-cmd": [
@@ -53,12 +53,15 @@
5353
"config": {
5454
"bin-dir": "bin",
5555
"platform": {
56-
"php": "5.3.9"
56+
"php": "5.5.9"
5757
}
5858
},
5959
"extra": {
6060
"symfony-app-dir": "app",
61+
"symfony-bin-dir": "bin",
62+
"symfony-var-dir": "var",
6163
"symfony-web-dir": "web",
64+
"symfony-tests-dir": "tests",
6265
"symfony-assets-install": "relative",
6366
"incenteev-parameters": {
6467
"file": "app/config/parameters.yml",

0 commit comments

Comments
 (0)