Skip to content

Commit 3015ac1

Browse files
author
Marie
authored
Merge pull request #6374 from akeneo/symfony-upgrade
TIP-747: upgrade the PIM from sf 2.8 to 3
2 parents 5b2a524 + 2fdba4e commit 3015ac1

183 files changed

Lines changed: 732 additions & 699 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ app/AppKernel_local.php
1212
app/console_local
1313
app/archive/*
1414
app/cache/*
15+
var/cache/*
1516
app/config/*_local.yml
1617
app/logs/*
18+
var/logs/*
19+
var/bootstrap.php.cache
1720
app/import/*
1821
app/export/*
1922
app/emails/*
@@ -32,6 +35,7 @@ composer.phar
3235
!/bin/docker/pim-initialize.sh
3336
!/bin/docker/pim-front.sh
3437
!/bin/merge-coverage
38+
!bin/console
3539
behat.yml
3640
/phpspec.yml
3741
uploads_test/

.php_cs.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
'@PSR2' => true,
66
'linebreak_after_opening_tag' => true,
77
'ordered_imports' => true,
8+
'method_argument_space' => [
9+
'ensure_fully_multiline' => false
10+
],
811
))
912
->setFinder(
1013
PhpCsFixer\Finder::create()

CHANGELOG-1.8.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- GITHUB-6174: Show a loading mask during the file upload in the import jobs
1717
- TIP-730: Reworking of the creation popin for basic entities
1818
- TIP-732: Rework the attribute form using the PEF architecture
19+
- TIP-747: Migrate to Symfony 3.3
1920

2021
## UI\UX Refactoring
2122

@@ -213,6 +214,12 @@
213214

214215
### Constructors
215216

217+
- Change the constructor of `Oro\Bundle\UserBundle\Form\Handler\AclRoleHandler` to add `Symfony\Component\HttpFoundation\RequestStack`
218+
- Change the constructor of `Oro\Bundle\DataGridBundle\Datagrid\RequestParameters` to add `Symfony\Component\HttpFoundation\RequestStack`
219+
- Change the constructor of `Pim\Bundle\DataGridBundle\Datagrid\Configuration\Product\ContextConfigurator` to add `Symfony\Component\HttpFoundation\RequestStack`
220+
- Change the constructor of `Pim\Bundle\DataGridBundle\Datagrid\Configuration\Product\GroupColumnsConfigurator` to add `Symfony\Component\HttpFoundation\RequestStack`
221+
- Change the constructor of `Pim\Bundle\DataGridBundle\Datagrid\Request\RequestParametersExtractor` to add `Symfony\Component\HttpFoundation\RequestStack`
222+
- Change the constructor of `Pim\Bundle\DataGridBundle\EventListener\AddParametersToProductGridListener` to add `Symfony\Component\HttpFoundation\RequestStack`
216223
- Change the constructor of `Pim\Component\Catalog\Updater\AssociationTypeUpdater` to add `Akeneo\Component\Localization\TranslatableUpdater`
217224
- Change the constructor of `Pim\Component\Catalog\Updater\ChannelUpdater` to add `Akeneo\Component\Localization\TranslatableUpdater`
218225
- Change the constructor of `Pim\Bundle\ApiBundle\Controller\ChannelController` to add `Akeneo\Component\StorageUtils\Factory\SimpleFactoryInterface`,

Jenkinsfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ stage("Checkout") {
5656
unstash "pim_community_dev"
5757

5858
sh "composer update --optimize-autoloader --no-interaction --no-progress --prefer-dist"
59-
sh "app/console assets:install"
60-
sh "app/console pim:installer:dump-require-paths"
59+
sh "bin/console assets:install"
60+
sh "bin/console pim:installer:dump-require-paths"
6161

6262
stash "pim_community_dev_full"
6363
}
@@ -101,8 +101,8 @@ stage("Checkout") {
101101
sh "php -d memory_limit=-1 /usr/local/bin/composer run-script post-update-cmd"
102102
}
103103

104-
sh "app/console assets:install"
105-
sh "app/console pim:installer:dump-require-paths"
104+
sh "bin/console assets:install"
105+
sh "bin/console pim:installer:dump-require-paths"
106106

107107
stash "pim_enterprise_dev_full"
108108
}
@@ -209,7 +209,7 @@ def runPhpUnitTest(phpVersion) {
209209

210210
sh "mkdir -p app/build/logs/"
211211

212-
sh "./bin/phpunit -c app/phpunit.xml.dist --testsuite PIM_Unit_Test --log-junit app/build/logs/phpunit.xml"
212+
sh "./vendor/bin/phpunit -c app/phpunit.xml.dist --testsuite PIM_Unit_Test --log-junit app/build/logs/phpunit.xml"
213213
}
214214
} finally {
215215
sh "docker stop \$(docker ps -a -q) || true"
@@ -275,7 +275,7 @@ void runIntegrationTest(String phpVersion, String edition, def testFiles) {
275275
sh "sed -i \"s#database_host: .*#database_host: mysql#g\" app/config/parameters_test.yml"
276276
sh "sed -i \"s#index_hosts: .*#index_hosts: 'elasticsearch:9200'#g\" app/config/parameters_test.yml"
277277

278-
sh "./app/console --env=test pim:install --force"
278+
sh "./bin/console --env=test pim:install --force"
279279

280280
sh "mkdir -p app/build/logs/"
281281

@@ -288,7 +288,7 @@ void runIntegrationTest(String phpVersion, String edition, def testFiles) {
288288

289289
sh "sleep 20"
290290

291-
sh "php -d error_reporting='E_ALL' ./bin/phpunit -c app/phpunit.xml.dist --testsuite PIM_Integration_Test --log-junit app/build/logs/phpunit_integration.xml"
291+
sh "php -d error_reporting='E_ALL' ./vendor/bin/phpunit -c app/phpunit.xml.dist --testsuite PIM_Integration_Test --log-junit app/build/logs/phpunit_integration.xml"
292292
}
293293
}
294294
}
@@ -314,7 +314,7 @@ def runPhpSpecTest(phpVersion) {
314314

315315
sh "mkdir -p app/build/logs/"
316316

317-
sh "./bin/phpspec run --no-interaction --format=junit > app/build/logs/phpspec.xml"
317+
sh "./vendor/bin/phpspec run --no-interaction --format=junit > app/build/logs/phpspec.xml"
318318
}
319319
} finally {
320320
sh "docker stop \$(docker ps -a -q) || true"
@@ -338,7 +338,7 @@ def runPhpCsFixerTest() {
338338

339339
sh "mkdir -p app/build/logs/"
340340

341-
sh "./bin/php-cs-fixer fix --diff --dry-run --format=junit --config=.php_cs.php > app/build/logs/phpcs.xml"
341+
sh "./vendor/bin/php-cs-fixer fix --diff --dry-run --format=junit --config=.php_cs.php > app/build/logs/phpcs.xml"
342342
}
343343
} finally {
344344
sh "docker stop \$(docker ps -a -q) || true"
@@ -366,6 +366,14 @@ def runBehatTest(edition, features, phpVersion) {
366366
}
367367

368368
// Configure the PIM
369+
dir("app") {
370+
sh "ln -s ./../bin/console"
371+
}
372+
373+
dir("bin") {
374+
sh "ln -s ./../vendor/bin/behat"
375+
}
376+
369377
sh "cp app/config/parameters.yml.dist app/config/parameters_test.yml"
370378
sh "sed -i \"s#database_host: .*#database_host: mysql#g\" app/config/parameters_test.yml"
371379
sh "sed -i \"s#index_hosts: .*#index_hosts: 'elasticsearch: 9200'#g\" app/config/parameters_test.yml"
@@ -398,7 +406,7 @@ def runPhpCouplingDetectorTest() {
398406
docker.image("akeneo/php:7.1").inside("-v /home/akeneo/.composer:/home/docker/.composer -e COMPOSER_HOME=/home/docker/.composer") {
399407
unstash "pim_community_dev_full"
400408

401-
sh "./bin/php-coupling-detector detect --config-file=.php_cd.php src"
409+
sh "./vendor/bin/php-coupling-detector detect --config-file=.php_cd.php src"
402410
}
403411
} finally {
404412
sh "docker stop \$(docker ps -a -q) || true"

UPGRADE-1.8.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TODO
3636

3737
```bash
3838
export PIM_DIR=/path/to/your/pim/installation
39-
cp app/SymfonyRequirements.php $PIM_DIR/app
39+
cp var/SymfonyRequirements.php $PIM_DIR/app
4040
cp app/PimRequirements.php $PIM_DIR/app
4141

4242
mv $PIM_DIR/app/config/pim_parameters.yml $PIM_DIR/app/config/pim_parameters.yml.bak
@@ -96,8 +96,8 @@ In this case, go to the chapter "Migrate your custom code" before running the da
9696
6. Then you can migrate your database using:
9797

9898
```bash
99-
rm -rf app/cache
100-
php app/console doctrine:migration:migrate --env=prod
99+
rm -rf var/cache
100+
php bin/console doctrine:migration:migrate --env=prod
101101
```
102102

103103
7. Then, generate JS translations and re-generate the PIM assets:
@@ -191,8 +191,8 @@ find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.product_val
191191
## Building the front-end with webpack
192192

193193
1. Install nodejs (tested with >=6.11.0 until 8.2.1) and npm 5.0.3, you can follow the instructions here - https://nodejs.org/en/download/package-manager/ or install with homebrew - `brew install node@6` should install both these versions.
194-
2. Run `php app/console pim:installer:dump-require-paths`
195-
3. Run `php app/console assets:install --symlink`
194+
2. Run `php bin/console pim:installer:dump-require-paths`
195+
3. Run `php bin/console assets:install --symlink`
196196
4. Create a file in your project root called `package.json` with the following contents:
197197

198198
```json
@@ -210,7 +210,7 @@ find ./src/ -type f -print0 | xargs -0 sed -i 's/pim_reference_data\.product_val
210210

211211
5. Run `npm install` inside your project root
212212
6. Run `npm run webpack`
213-
7. Run `php app/console cache:clear`
213+
7. Run `php bin/console cache:clear`
214214
8. Add to your .gitignore the following lines:
215215

216216
```

app/AppKernel.php

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function registerBundles()
5656
*/
5757
public function registerContainerConfiguration(LoaderInterface $loader)
5858
{
59-
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
59+
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
6060

61-
if (is_file($file = __DIR__.'/config/config_'.$this->getEnvironment().'_local.yml')) {
61+
if (is_file($file = $this->getRootDir() . '/config/config_' . $this->getEnvironment() . '_local.yml')) {
6262
$loader->load($file);
6363
}
6464
}
@@ -172,4 +172,34 @@ protected function getOroBundles()
172172
new Oro\Bundle\UserBundle\OroUserBundle(),
173173
];
174174
}
175+
176+
/**
177+
* @return string
178+
*/
179+
public function getRootDir(): string
180+
{
181+
return __DIR__;
182+
}
183+
184+
/**
185+
* @return string
186+
*/
187+
public function getCacheDir(): string
188+
{
189+
return dirname(__DIR__)
190+
. DIRECTORY_SEPARATOR
191+
. 'var'
192+
. DIRECTORY_SEPARATOR
193+
. 'cache'
194+
. DIRECTORY_SEPARATOR
195+
. $this->getEnvironment();
196+
}
197+
198+
/**
199+
* @return string
200+
*/
201+
public function getLogDir(): string
202+
{
203+
return dirname(__DIR__) . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'logs';
204+
}
175205
}

app/OroRequirements.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require_once __DIR__ . '/SymfonyRequirements.php';
3+
require_once __DIR__ . '/../var/SymfonyRequirements.php';
44

55
use Symfony\Component\Intl\Intl;
66
use Symfony\Component\Process\ProcessBuilder;
@@ -93,8 +93,8 @@ function ($cfgValue) use ($mem) {
9393

9494
$directories = array(
9595
'web/bundles',
96-
'app/cache',
97-
'app/logs',
96+
'var/cache',
97+
'var/logs',
9898
);
9999
foreach ($directories as $directory) {
100100
$this->addOroRequirement(

app/autoload.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?php
22

3-
use Composer\Autoload\ClassLoader;
43
use Doctrine\Common\Annotations\AnnotationRegistry;
4+
use Composer\Autoload\ClassLoader;
55

66
/**
7-
* @var $loader ClassLoader
7+
* @var ClassLoader $loader
88
*/
99
$loader = require __DIR__.'/../vendor/autoload.php';
1010

11-
// add possibility to extends doctrine unit test and use mocks
1211
$loader->add( 'Doctrine\\Tests', __DIR__.'/../vendor/doctrine/orm/tests' );
1312

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

1615
return $loader;

0 commit comments

Comments
 (0)