Use Symfony 3 directory structure

This commit is contained in:
Kamil Kokot 2016-11-15 14:57:52 +01:00
parent c36855dc2e
commit 51f1fec642
No known key found for this signature in database
GPG key ID: 7BD76F7054D93C89
34 changed files with 249 additions and 120 deletions

10
.gitignore vendored
View file

@ -1,14 +1,9 @@
/.php_cs.cache /.php_cs.cache
/app/*.cache
/app/cache
/app/logs
/app/check.php
/app/SymfonyRequirements.php
/app/config/parameters.yml /app/config/parameters.yml
/app/config/*.local.yml /app/config/*.local.yml
/var/*
!/var/.gitkeep
/web/assets /web/assets
/web/bundles /web/bundles
@ -16,7 +11,6 @@
/web/js /web/js
/web/media /web/media
/bin
/vendor /vendor
/node_modules /node_modules

View file

@ -1 +0,0 @@
deny from all

View file

@ -28,13 +28,13 @@ class TestAppKernel extends AppKernel
return; return;
} }
if (!in_array($this->environment, ['test', 'test_cached'], true)) { if (!in_array($this->getEnvironment(), ['test', 'test_cached'], true)) {
parent::shutdown(); parent::shutdown();
return; return;
} }
$container = $this->container; $container = $this->getContainer();
parent::shutdown(); parent::shutdown();
$this->cleanupContainer($container); $this->cleanupContainer($container);
} }

View file

@ -1,23 +1,11 @@
<?php <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php'; $loader = require __DIR__.'/../vendor/autoload.php';
// Intl stubs. AnnotationRegistry::registerLoader([$loader, 'loadClass']);
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
}
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader; return $loader;

View file

@ -1,26 +0,0 @@
#!/usr/bin/env php
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
set_time_limit(0);
require_once __DIR__.'/bootstrap.php.cache';
require_once __DIR__.'/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
$application = new Application(new AppKernel($env, $debug));
$application->run($input);

28
bin/console Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env php
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
set_time_limit(0);
/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
if ($debug) {
Debug::enable();
}
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

143
bin/symfony_requirements Executable file
View file

@ -0,0 +1,143 @@
#!/usr/bin/env php
<?php
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
$lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo_title('Symfony Requirements Checker');
echo '> PHP is using the following php.ini file:'.PHP_EOL;
if ($iniPath) {
echo_style('green', ' '.$iniPath);
} else {
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!');
}
echo PHP_EOL.PHP_EOL;
echo '> Checking Symfony requirements:'.PHP_EOL.' ';
$messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('red', 'E');
$messages['error'][] = $helpText;
} else {
echo_style('green', '.');
}
}
$checkPassed = empty($messages['error']);
foreach ($symfonyRequirements->getRecommendations() as $req) {
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('yellow', 'W');
$messages['warning'][] = $helpText;
} else {
echo_style('green', '.');
}
}
if ($checkPassed) {
echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
} else {
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
echo_title('Fix the following mandatory requirements', 'red');
foreach ($messages['error'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
if (!empty($messages['warning'])) {
echo_title('Optional recommendations to improve your setup', 'yellow');
foreach ($messages['warning'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
echo PHP_EOL;
echo_style('title', 'Note');
echo ' The command console could use a different php.ini file'.PHP_EOL;
echo_style('title', '~~~~');
echo ' than the one used with your web server. To be on the'.PHP_EOL;
echo ' safe side, please check the requirements from your web'.PHP_EOL;
echo ' server using the ';
echo_style('yellow', 'web/config.php');
echo ' script.'.PHP_EOL;
echo PHP_EOL;
exit($checkPassed ? 0 : 1);
function get_error_message(Requirement $requirement, $lineSize)
{
if ($requirement->isFulfilled()) {
return;
}
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL;
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL;
return $errorMessage;
}
function echo_title($title, $style = null)
{
$style = $style ?: 'title';
echo PHP_EOL;
echo_style($style, $title.PHP_EOL);
echo_style($style, str_repeat('~', strlen($title)).PHP_EOL);
echo PHP_EOL;
}
function echo_style($style, $message)
{
// ANSI color codes
$styles = array(
'reset' => "\033[0m",
'red' => "\033[31m",
'green' => "\033[32m",
'yellow' => "\033[33m",
'error' => "\033[37;41m",
'success' => "\033[37;42m",
'title' => "\033[34m",
);
$supports = has_color_support();
echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
}
function echo_block($style, $title, $message)
{
$message = ' '.trim($message).' ';
$width = strlen($message);
echo PHP_EOL.PHP_EOL;
echo_style($style, str_repeat(' ', $width).PHP_EOL);
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_repeat(' ', $width).PHP_EOL);
}
function has_color_support()
{
static $support;
if (null === $support) {
if (DIRECTORY_SEPARATOR == '\\') {
$support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
} else {
$support = function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
}
return $support;
}

View file

@ -151,14 +151,16 @@
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
], ],
"post-update-cmd": [ "post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
] ]
}, },
"autoload": { "autoload": {
@ -166,24 +168,26 @@
"Sylius\\Behat\\": "src/Sylius/Behat/", "Sylius\\Behat\\": "src/Sylius/Behat/",
"Sylius\\Bundle\\": "src/Sylius/Bundle/", "Sylius\\Bundle\\": "src/Sylius/Bundle/",
"Sylius\\Component\\": "src/Sylius/Component/" "Sylius\\Component\\": "src/Sylius/Component/"
} },
"classmap": ["app/AppKernel.php", "app/AppCache.php"]
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Sylius\\Tests\\": "tests/" "Sylius\\Tests\\": "tests/"
} }
}, },
"config": {
"bin-dir": "bin"
},
"extra": { "extra": {
"branch-alias": { "symfony-app-dir": "app",
"dev-master": "1.0-dev" "symfony-bin-dir": "bin",
}, "symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": { "incenteev-parameters": {
"file": "app/config/parameters.yml" "file": "app/config/parameters.yml"
}, },
"symfony-app-dir": "app", "branch-alias": {
"symfony-web-dir": "web" "dev-master": "1.0-dev"
}
} }
} }

4
composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "42e8020a0711d3ee7a06f07e6cd2f0d3", "hash": "bbdd77740308132c5daefdc92f713124",
"content-hash": "a4f029c6ab692fed4b71f6693bfbbc15", "content-hash": "615c38d1a2a7b742dc97a6ca4595b41d",
"packages": [ "packages": [
{ {
"name": "behat/transliterator", "name": "behat/transliterator",

View file

@ -3,10 +3,10 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../bash/common.lib.sh"
print_header "Setting the application up" "Sylius" print_header "Setting the application up" "Sylius"
run_command "app/console doctrine:database:create --env=test_cached -vvv" || exit $? # Have to be run with debug = true, to omit generating proxies before setting up the database run_command "bin/console doctrine:database:create --env=test_cached -vvv" || exit $? # Have to be run with debug = true, to omit generating proxies before setting up the database
run_command "app/console cache:warmup --env=test_cached --no-debug -vvv" || exit $? run_command "bin/console cache:warmup --env=test_cached --no-debug -vvv" || exit $?
run_command "app/console doctrine:migrations:migrate --no-interaction --env=test_cached --no-debug -vvv" || exit $? run_command "bin/console doctrine:migrations:migrate --no-interaction --env=test_cached --no-debug -vvv" || exit $?
print_header "Setting the web assets up" "sylius" print_header "Setting the web assets up" "sylius"
run_command "app/console assets:install --env=test_cached --no-debug -vvv" || exit $? run_command "bin/console assets:install --env=test_cached --no-debug -vvv" || exit $?
run_command "npm run gulp" || exit $? run_command "npm run gulp" || exit $?

View file

@ -6,9 +6,9 @@ run_behat() {
local code=0 local code=0
print_header "Testing (Behat - CLI commands, regular scenarios; @cli && ~@todo)" "Sylius" print_header "Testing (Behat - CLI commands, regular scenarios; @cli && ~@todo)" "Sylius"
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\"" || code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\"" || code=$?
if [[ ${code} = 1 ]]; then if [[ ${code} = 1 ]]; then
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\" --rerun" ; code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@cli && ~@todo\" --rerun" ; code=$?
fi fi
return ${code} return ${code}

View file

@ -19,19 +19,19 @@ prepare_for_behat_with_js() {
fi fi
# Run Selenium with ChromeDriver # Run Selenium with ChromeDriver
run_command "bin/selenium-server-standalone -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver > $SYLIUS_BUILD_DIR/selenium.log 2>&1 &" run_command "vendor/bin/selenium-server-standalone -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver > $SYLIUS_BUILD_DIR/selenium.log 2>&1 &"
# Run webserver # Run webserver
run_command "app/console server:run 127.0.0.1:8080 --env=test_cached --router=app/config/router_test_cached.php --no-debug > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &" run_command "bin/console server:run 127.0.0.1:8080 --env=test_cached --router=app/config/router_test_cached.php --no-debug > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &"
} }
run_behat() { run_behat() {
local code=0 local code=0
print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius" print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius"
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\"" || code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\"" || code=$?
if [[ ${code} = 1 ]]; then if [[ ${code} = 1 ]]; then
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
fi fi
return ${code} return ${code}

View file

@ -6,9 +6,9 @@ run_behat() {
local code=0 local code=0
print_header "Testing (Behat - brand new, regular scenarios; ~@javascript && ~@todo && ~@cli)" "Sylius" print_header "Testing (Behat - brand new, regular scenarios; ~@javascript && ~@todo && ~@cli)" "Sylius"
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\"" || code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\"" || code=$?
if [[ ${code} = 1 ]]; then if [[ ${code} = 1 ]]; then
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\" --rerun" ; code=$? run_command "vendor/bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"~@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
fi fi
return ${code} return ${code}

View file

@ -3,4 +3,4 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
print_header "Testing (Fixtures)" "Sylius" print_header "Testing (Fixtures)" "Sylius"
retry_run_command "app/console sylius:fixtures:load default --env=test_cached --no-debug" retry_run_command "bin/console sylius:fixtures:load default --env=test_cached --no-debug"

View file

@ -3,4 +3,4 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
print_header "Testing (Phpspec)" "Sylius" print_header "Testing (Phpspec)" "Sylius"
run_command "bin/phpspec run --no-interaction -f dot" run_command "vendor/bin/phpspec run --no-interaction -f dot"

View file

@ -3,4 +3,4 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
print_header "Testing (Phpunit)" "Sylius" print_header "Testing (Phpunit)" "Sylius"
run_command "bin/phpunit" run_command "vendor/bin/phpunit"

View file

@ -3,4 +3,4 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
print_header "Validating (Behat features)" "Sylius" print_header "Validating (Behat features)" "Sylius"
run_command "bin/kawaii gherkin:check --align=left features/" run_command "vendor/bin/kawaii gherkin:check --align=left features/"

View file

@ -3,4 +3,4 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh" source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../../bash/common.lib.sh"
print_header "Validating (Doctrine schema)" "Sylius" print_header "Validating (Doctrine schema)" "Sylius"
run_command "app/console doctrine:schema:validate --env=test_cached --no-debug -vvv" run_command "bin/console doctrine:schema:validate --env=test_cached --no-debug -vvv"

View file

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.6/phpunit.xsd"
backupGlobals="false" backupGlobals="false"
colors="true" colors="true"
bootstrap="app/bootstrap.php.cache" bootstrap="var/bootstrap.php.cache">
>
<testsuites> <testsuites>
<testsuite name="Sylius Test Suite"> <testsuite name="Sylius Test Suite">
<directory>tests</directory> <directory>tests</directory>

View file

@ -42,4 +42,4 @@ sylius_admin_taxon_create_for_parent:
vars: vars:
subheader: sylius.ui.manage_categorization_of_your_product subheader: sylius.ui.manage_categorization_of_your_product
templates: templates:
form: @SyliusAdmin/Taxon/_form.html.twig form: "@SyliusAdmin/Taxon/_form.html.twig"

View file

@ -13,11 +13,12 @@
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services> <services>
<service id="sylius.menu_builder.admin.main" class="Sylius\Bundle\AdminBundle\Menu\MainMenuBuilder" parent="sylius.menu_builder"> <service id="sylius.menu_builder.admin.main" class="Sylius\Bundle\AdminBundle\Menu\MainMenuBuilder"
parent="sylius.menu_builder" public="false">
<argument type="service" id="sylius.resource_controller.authorization_checker" /> <argument type="service" id="sylius.resource_controller.authorization_checker" />
</service> </service>
<service id="sylius.menu.admin.main" class="Knp\Menu\MenuItem" factory-service="sylius.menu_builder.admin.main" factory-method="createMenu" scope="request"> <service id="sylius.menu.admin.main" class="Knp\Menu\MenuItem">
<argument type="service" id="request" /> <factory service="sylius.menu_builder.admin.main" method="createMenu" />
<tag name="knp_menu.menu" alias="sylius.admin.main" /> <tag name="knp_menu.menu" alias="sylius.admin.main" />
</service> </service>
</services> </services>

View file

@ -38,7 +38,7 @@ final class Configuration implements ConfigurationInterface
$rootNode $rootNode
->children() ->children()
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end() ->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
->booleanNode('debug')->defaultValue('%kernel.debug%')->cannotBeEmpty()->end() ->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->end() ->end()
; ;

View file

@ -86,9 +86,10 @@ class Kernel extends HttpKernel
new \Sylius\Bundle\ThemeBundle\SyliusThemeBundle(), // must be added after FrameworkBundle new \Sylius\Bundle\ThemeBundle\SyliusThemeBundle(), // must be added after FrameworkBundle
]; ];
if (in_array($this->environment, ['dev', 'test', 'test_cached'], true)) { if (in_array($this->getEnvironment(), ['dev', 'test', 'test_cached'], true)) {
$bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new \Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
} }
return $bundles; return $bundles;
@ -99,7 +100,7 @@ class Kernel extends HttpKernel
*/ */
protected function getContainerBaseClass() protected function getContainerBaseClass()
{ {
if ('test' === $this->environment || 'test_cached' === $this->environment) { if (in_array($this->getEnvironment(), ['test', 'test_cached'], true)) {
return MockerContainer::class; return MockerContainer::class;
} }
@ -111,11 +112,10 @@ class Kernel extends HttpKernel
*/ */
public function registerContainerConfiguration(LoaderInterface $loader) public function registerContainerConfiguration(LoaderInterface $loader)
{ {
$rootDir = $this->getRootDir(); $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
$loader->load($rootDir.'/config/config_'.$this->environment.'.yml'); $file = $this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.local.yml';
if (is_file($file)) {
if (is_file($file = $rootDir.'/config/config_'.$this->environment.'.local.yml')) {
$loader->load($file); $loader->load($file);
} }
} }
@ -126,10 +126,10 @@ class Kernel extends HttpKernel
public function getCacheDir() public function getCacheDir()
{ {
if ($this->isVagrantEnvironment()) { if ($this->isVagrantEnvironment()) {
return '/dev/shm/sylius/cache/'.$this->environment; return '/dev/shm/sylius/cache/' . $this->getEnvironment();
} }
return parent::getCacheDir(); return dirname($this->getRootDir()) . '/var/cache/' . $this->getEnvironment();
} }
/** /**
@ -141,7 +141,7 @@ class Kernel extends HttpKernel
return '/dev/shm/sylius/logs'; return '/dev/shm/sylius/logs';
} }
return parent::getLogDir(); return dirname($this->getRootDir()) . '/var/logs';
} }
/** /**

View file

@ -37,7 +37,7 @@ final class TaxRateFixture extends AbstractResourceFixture
->scalarNode('name')->cannotBeEmpty()->end() ->scalarNode('name')->cannotBeEmpty()->end()
->scalarNode('zone')->cannotBeEmpty()->end() ->scalarNode('zone')->cannotBeEmpty()->end()
->scalarNode('category')->cannotBeEmpty()->end() ->scalarNode('category')->cannotBeEmpty()->end()
->floatNode('amount')->cannotBeEmpty()->end() ->floatNode('amount')->end()
->booleanNode('included_in_price')->end() ->booleanNode('included_in_price')->end()
->scalarNode('calculator')->cannotBeEmpty()->end() ->scalarNode('calculator')->cannotBeEmpty()->end()
; ;

View file

@ -42,7 +42,7 @@ final class SyliusPricingExtension extends Extension
new Reference('sylius.registry.price_calculator'), new Reference('sylius.registry.price_calculator'),
new Reference('sylius.form.subscriber.priceable'), new Reference('sylius.form.subscriber.priceable'),
]) ])
->addTag('form.type_extension', ['alias' => $formType]) ->addTag('form.type_extension', ['alias' => $formType, 'extended_type' => $formType])
; ;
$container->setDefinition(sprintf('sylius.form.extension.priceable.%s', $formType), $definition); $container->setDefinition(sprintf('sylius.form.extension.priceable.%s', $formType), $definition);

View file

@ -36,7 +36,7 @@
</service> </service>
<service id="sylius.form.extension.collection" class="Sylius\Bundle\ResourceBundle\Form\Extension\CollectionExtension"> <service id="sylius.form.extension.collection" class="Sylius\Bundle\ResourceBundle\Form\Extension\CollectionExtension">
<tag name="form.type_extension" alias="collection" /> <tag name="form.type_extension" alias="collection" extended-type="collection" />
</service> </service>
</services> </services>
</container> </container>

View file

@ -92,11 +92,6 @@ final class ResourceControllerSpec extends ObjectBehavior
$this->shouldHaveType(ResourceController::class); $this->shouldHaveType(ResourceController::class);
} }
function it_is_container_aware()
{
$this->shouldHaveType(ContainerAware::class);
}
function it_extends_base_Symfony_controller() function it_extends_base_Symfony_controller()
{ {
$this->shouldHaveType(Controller::class); $this->shouldHaveType(Controller::class);

View file

@ -13,9 +13,10 @@
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services> <services>
<service id="sylius.menu_builder.shop.account" class="Sylius\Bundle\ShopBundle\Menu\AccountMenuBuilder" parent="sylius.menu_builder" /> <service id="sylius.menu_builder.shop.account" class="Sylius\Bundle\ShopBundle\Menu\AccountMenuBuilder"
<service id="sylius.menu.shop.account" class="Knp\Menu\MenuItem" factory-service="sylius.menu_builder.shop.account" factory-method="createMenu" scope="request"> parent="sylius.menu_builder" public="false" />
<argument type="service" id="request" /> <service id="sylius.menu.shop.account" class="Knp\Menu\MenuItem">
<factory service="sylius.menu_builder.shop.account" method="createMenu" />
<tag name="knp_menu.menu" alias="sylius.shop.account" /> <tag name="knp_menu.menu" alias="sylius.shop.account" />
</service> </service>
</services> </services>

View file

@ -65,7 +65,7 @@
</service> </service>
<!-- Overridden services --> <!-- Overridden services -->
<service id="templating.cache_warmer.template_paths" class="%templating.cache_warmer.template_paths.class%" public="false"> <service id="templating.cache_warmer.template_paths" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer" public="false">
<argument type="service" id="templating.finder" /> <argument type="service" id="templating.finder" />
<argument type="service" id="sylius.theme.templating.file_locator.inner" /> <!-- using default templating locator, as TemplatePathsCacheWarmer accepts TemplateLocator class instances only --> <argument type="service" id="sylius.theme.templating.file_locator.inner" /> <!-- using default templating locator, as TemplatePathsCacheWarmer accepts TemplateLocator class instances only -->
<tag name="kernel.cache_warmer" priority="20" /> <tag name="kernel.cache_warmer" priority="20" />

0
var/.gitkeep Normal file
View file

View file

@ -16,8 +16,9 @@ use Symfony\Component\HttpFoundation\Request;
* Live (production) environment. * Live (production) environment.
*/ */
require_once __DIR__.'/../app/bootstrap.php.cache'; /** @var \Composer\Autoload\ClassLoader $loader */
require_once __DIR__.'/../app/AppKernel.php'; $loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('prod', false); $kernel = new AppKernel('prod', false);
$kernel->loadClassCache(); $kernel->loadClassCache();

View file

@ -30,8 +30,9 @@ if (!getenv("SYLIUS_APP_DEV_PERMITTED") && (
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
} }
require_once __DIR__.'/../app/bootstrap.php.cache'; /** @var \Composer\Autoload\ClassLoader $loader */
require_once __DIR__.'/../app/AppKernel.php'; $loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
Debug::enable(); Debug::enable();

View file

@ -25,8 +25,9 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
} }
require_once __DIR__.'/../app/bootstrap.php.cache'; /** @var \Composer\Autoload\ClassLoader $loader */
require_once __DIR__.'/../app/AppKernel.php'; $loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
Debug::enable(); Debug::enable();

View file

@ -24,8 +24,9 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
} }
require_once __DIR__.'/../app/bootstrap.php.cache'; /** @var \Composer\Autoload\ClassLoader $loader */
require_once __DIR__.'/../app/AppKernel.php'; $loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('test_cached', false); $kernel = new AppKernel('test_cached', false);
$kernel->loadClassCache(); $kernel->loadClassCache();