feature #22800 [FrameworkBundle] Remove deprecated code (ogizanagi)
This PR was merged into the 4.0-dev branch.
Discussion
----------
[FrameworkBundle] Remove deprecated code
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | yes
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Remove deprecated code in the FrameworkBundle (except compiler passes and stuff already removed by #22749):
* Removed `cache:clear` warmup part along with the `--no-optional-warmers` option.
* Removed core form types services registration when unnecessary
* Removed `framework.serializer.cache` option and `serializer.mapping.cache.apc`, `serializer.mapping.cache.doctrine.apc` services
* Removed `ConstraintValidatorFactory::$validators` and `ConstraintValidatorFactory::$container` protected properties
* Removed class parameters related to routing
* Removed absolute template paths support in the template name parser
Commits
-------
531156e
[FrameworkBundle] Remove deprecated code
This commit is contained in:
commit
3ae491a99d
@ -11,6 +11,12 @@ CHANGELOG
|
|||||||
`RoutingResolverPass`, `SerializerPass`, `ValidateWorkflowsPass`
|
`RoutingResolverPass`, `SerializerPass`, `ValidateWorkflowsPass`
|
||||||
* made `Translator::__construct()` `$defaultLocale` argument required
|
* made `Translator::__construct()` `$defaultLocale` argument required
|
||||||
* removed `SessionListener`, `TestSessionListener`
|
* removed `SessionListener`, `TestSessionListener`
|
||||||
|
* Removed `cache:clear` warmup part along with the `--no-optional-warmers` option
|
||||||
|
* Removed core form types services registration when unnecessary
|
||||||
|
* Removed `framework.serializer.cache` option and `serializer.mapping.cache.apc`, `serializer.mapping.cache.doctrine.apc` services
|
||||||
|
* Removed `ConstraintValidatorFactory::$validators` and `ConstraintValidatorFactory::$container` protected properties
|
||||||
|
* Removed class parameters related to routing
|
||||||
|
* Removed absolute template paths support in the template name parser
|
||||||
|
|
||||||
3.3.0
|
3.3.0
|
||||||
-----
|
-----
|
||||||
|
@ -15,8 +15,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
|
||||||
use Symfony\Component\Finder\Finder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear and Warmup the cache.
|
* Clear and Warmup the cache.
|
||||||
@ -34,8 +32,7 @@ class CacheClearCommand extends ContainerAwareCommand
|
|||||||
$this
|
$this
|
||||||
->setName('cache:clear')
|
->setName('cache:clear')
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
|
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Noop. Will be deprecated in 4.1 to be removed in 5.0.'),
|
||||||
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
|
|
||||||
))
|
))
|
||||||
->setDescription('Clears the cache')
|
->setDescription('Clears the cache')
|
||||||
->setHelp(<<<'EOF'
|
->setHelp(<<<'EOF'
|
||||||
@ -56,37 +53,22 @@ EOF
|
|||||||
{
|
{
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
|
$cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
|
||||||
// the old cache dir name must not be longer than the real one to avoid exceeding
|
|
||||||
// the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
|
|
||||||
$oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~');
|
|
||||||
$filesystem = $this->getContainer()->get('filesystem');
|
$filesystem = $this->getContainer()->get('filesystem');
|
||||||
|
|
||||||
if (!is_writable($realCacheDir)) {
|
if (!is_writable($cacheDir)) {
|
||||||
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
|
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $cacheDir));
|
||||||
}
|
|
||||||
|
|
||||||
if ($filesystem->exists($oldCacheDir)) {
|
|
||||||
$filesystem->remove($oldCacheDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$kernel = $this->getContainer()->get('kernel');
|
$kernel = $this->getContainer()->get('kernel');
|
||||||
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
||||||
$this->getContainer()->get('cache_clearer')->clear($realCacheDir);
|
$this->getContainer()->get('cache_clearer')->clear($cacheDir);
|
||||||
|
|
||||||
if ($input->getOption('no-warmup')) {
|
|
||||||
$filesystem->rename($realCacheDir, $oldCacheDir);
|
|
||||||
} else {
|
|
||||||
@trigger_error('Calling cache:clear without the --no-warmup option is deprecated since version 3.3. Cache warmup should be done with the cache:warmup command instead.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
$this->warmupCache($input, $output, $realCacheDir, $oldCacheDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output->isVerbose()) {
|
if ($output->isVerbose()) {
|
||||||
$io->comment('Removing old cache directory...');
|
$io->comment('Removing old cache directory...');
|
||||||
}
|
}
|
||||||
|
|
||||||
$filesystem->remove($oldCacheDir);
|
$filesystem->remove($cacheDir);
|
||||||
|
|
||||||
if ($output->isVerbose()) {
|
if ($output->isVerbose()) {
|
||||||
$io->comment('Finished');
|
$io->comment('Finished');
|
||||||
@ -94,171 +76,4 @@ EOF
|
|||||||
|
|
||||||
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function warmupCache(InputInterface $input, OutputInterface $output, $realCacheDir, $oldCacheDir)
|
|
||||||
{
|
|
||||||
$filesystem = $this->getContainer()->get('filesystem');
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
|
||||||
|
|
||||||
// the warmup cache dir name must have the same length than the real one
|
|
||||||
// to avoid the many problems in serialized resources files
|
|
||||||
$realCacheDir = realpath($realCacheDir);
|
|
||||||
$warmupDir = substr($realCacheDir, 0, -1).('_' === substr($realCacheDir, -1) ? '-' : '_');
|
|
||||||
|
|
||||||
if ($filesystem->exists($warmupDir)) {
|
|
||||||
if ($output->isVerbose()) {
|
|
||||||
$io->comment('Clearing outdated warmup directory...');
|
|
||||||
}
|
|
||||||
$filesystem->remove($warmupDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output->isVerbose()) {
|
|
||||||
$io->comment('Warming up cache...');
|
|
||||||
}
|
|
||||||
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
|
|
||||||
|
|
||||||
$filesystem->rename($realCacheDir, $oldCacheDir);
|
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
|
||||||
sleep(1); // workaround for Windows PHP rename bug
|
|
||||||
}
|
|
||||||
$filesystem->rename($warmupDir, $realCacheDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $warmupDir
|
|
||||||
* @param string $realCacheDir
|
|
||||||
* @param bool $enableOptionalWarmers
|
|
||||||
*
|
|
||||||
* @internal to be removed in 4.0
|
|
||||||
*/
|
|
||||||
protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = true)
|
|
||||||
{
|
|
||||||
// create a temporary kernel
|
|
||||||
$realKernel = $this->getContainer()->get('kernel');
|
|
||||||
$realKernelClass = get_class($realKernel);
|
|
||||||
$namespace = '';
|
|
||||||
if (false !== $pos = strrpos($realKernelClass, '\\')) {
|
|
||||||
$namespace = substr($realKernelClass, 0, $pos);
|
|
||||||
$realKernelClass = substr($realKernelClass, $pos + 1);
|
|
||||||
}
|
|
||||||
$tempKernel = $this->getTempKernel($realKernel, $namespace, $realKernelClass, $warmupDir);
|
|
||||||
$tempKernel->boot();
|
|
||||||
|
|
||||||
$tempKernelReflection = new \ReflectionObject($tempKernel);
|
|
||||||
$tempKernelFile = $tempKernelReflection->getFileName();
|
|
||||||
|
|
||||||
// warmup temporary dir
|
|
||||||
$warmer = $tempKernel->getContainer()->get('cache_warmer');
|
|
||||||
if ($enableOptionalWarmers) {
|
|
||||||
$warmer->enableOptionalWarmers();
|
|
||||||
}
|
|
||||||
$warmer->warmUp($warmupDir);
|
|
||||||
|
|
||||||
// fix references to the Kernel in .meta files
|
|
||||||
$safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel));
|
|
||||||
$realKernelFQN = get_class($realKernel);
|
|
||||||
|
|
||||||
foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) {
|
|
||||||
file_put_contents($file, preg_replace(
|
|
||||||
'/(C\:\d+\:)"'.$safeTempKernel.'"/',
|
|
||||||
sprintf('$1"%s"', $realKernelFQN),
|
|
||||||
file_get_contents($file)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix references to cached files with the real cache directory name
|
|
||||||
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
|
|
||||||
$replace = str_replace('\\', '/', $realCacheDir);
|
|
||||||
foreach (Finder::create()->files()->in($warmupDir) as $file) {
|
|
||||||
$content = str_replace($search, $replace, file_get_contents($file));
|
|
||||||
file_put_contents($file, $content);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix references to container's class
|
|
||||||
$tempContainerClass = get_class($tempKernel->getContainer());
|
|
||||||
$realContainerClass = get_class($realKernel->getContainer());
|
|
||||||
foreach (Finder::create()->files()->name($tempContainerClass.'*')->in($warmupDir) as $file) {
|
|
||||||
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
|
|
||||||
file_put_contents($file, $content);
|
|
||||||
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove temp kernel file after cache warmed up
|
|
||||||
@unlink($tempKernelFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param KernelInterface $parent
|
|
||||||
* @param string $namespace
|
|
||||||
* @param string $parentClass
|
|
||||||
* @param string $warmupDir
|
|
||||||
*
|
|
||||||
* @return KernelInterface
|
|
||||||
*
|
|
||||||
* @internal to be removed in 4.0
|
|
||||||
*/
|
|
||||||
protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
|
|
||||||
{
|
|
||||||
$cacheDir = var_export($warmupDir, true);
|
|
||||||
$rootDir = var_export(realpath($parent->getRootDir()), true);
|
|
||||||
$logDir = var_export(realpath($parent->getLogDir()), true);
|
|
||||||
// the temp kernel class name must have the same length than the real one
|
|
||||||
// to avoid the many problems in serialized resources files
|
|
||||||
$class = substr($parentClass, 0, -1).'_';
|
|
||||||
// the temp container class must be changed too
|
|
||||||
$containerClass = var_export(substr(get_class($parent->getContainer()), 0, -1).'_', true);
|
|
||||||
$code = <<<EOF
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace $namespace
|
|
||||||
{
|
|
||||||
class $class extends $parentClass
|
|
||||||
{
|
|
||||||
public function getCacheDir()
|
|
||||||
{
|
|
||||||
return $cacheDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRootDir()
|
|
||||||
{
|
|
||||||
return $rootDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLogDir()
|
|
||||||
{
|
|
||||||
return $logDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getContainerClass()
|
|
||||||
{
|
|
||||||
return $containerClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildContainer()
|
|
||||||
{
|
|
||||||
\$container = parent::buildContainer();
|
|
||||||
|
|
||||||
// filter container's resources, removing reference to temp kernel file
|
|
||||||
\$resources = \$container->getResources();
|
|
||||||
\$filteredResources = array();
|
|
||||||
foreach (\$resources as \$resource) {
|
|
||||||
if ((string) \$resource !== __FILE__) {
|
|
||||||
\$filteredResources[] = \$resource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
\$container->setResources(\$filteredResources);
|
|
||||||
|
|
||||||
return \$container;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF;
|
|
||||||
$this->getContainer()->get('filesystem')->mkdir($warmupDir);
|
|
||||||
file_put_contents($file = $warmupDir.'/kernel.tmp', $code);
|
|
||||||
require_once $file;
|
|
||||||
$class = "$namespace\\$class";
|
|
||||||
|
|
||||||
return new $class($parent->getEnvironment(), $parent->isDebug());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -65,12 +65,6 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
|
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
|
||||||
->defaultTrue()
|
->defaultTrue()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('trusted_proxies') // @deprecated in version 3.3, to be removed in 4.0
|
|
||||||
->beforeNormalization()
|
|
||||||
->always()
|
|
||||||
->thenInvalid('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.')
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
->scalarNode('ide')->defaultNull()->end()
|
->scalarNode('ide')->defaultNull()->end()
|
||||||
->booleanNode('test')->end()
|
->booleanNode('test')->end()
|
||||||
->scalarNode('default_locale')->defaultValue('en')->end()
|
->scalarNode('default_locale')->defaultValue('en')->end()
|
||||||
|
@ -1242,18 +1242,7 @@ class FrameworkExtension extends Extension
|
|||||||
$chainLoader->replaceArgument(0, $serializerLoaders);
|
$chainLoader->replaceArgument(0, $serializerLoaders);
|
||||||
$container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders);
|
$container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders);
|
||||||
|
|
||||||
if (isset($config['cache']) && $config['cache']) {
|
if (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) {
|
||||||
@trigger_error('The "framework.serializer.cache" option is deprecated since Symfony 3.1 and will be removed in 4.0. Configure the "cache.serializer" service under "framework.cache.pools" instead.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
$container->setParameter(
|
|
||||||
'serializer.mapping.cache.prefix',
|
|
||||||
'serializer_'.$this->getKernelRootHash($container)
|
|
||||||
);
|
|
||||||
|
|
||||||
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
|
|
||||||
1, new Reference($config['cache'])
|
|
||||||
);
|
|
||||||
} elseif (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) {
|
|
||||||
$cacheMetadataFactory = new Definition(
|
$cacheMetadataFactory = new Definition(
|
||||||
CacheClassMetadataFactory::class,
|
CacheClassMetadataFactory::class,
|
||||||
array(
|
array(
|
||||||
|
@ -60,14 +60,6 @@ class FrameworkBundle extends Bundle
|
|||||||
{
|
{
|
||||||
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
|
||||||
|
|
||||||
if ($this->container->hasParameter('kernel.trusted_proxies')) {
|
|
||||||
@trigger_error('The "kernel.trusted_proxies" parameter is deprecated since version 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) {
|
|
||||||
Request::setTrustedProxies($trustedProxies, Request::getTrustedHeaderSet());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->container->getParameter('kernel.http_method_override')) {
|
if ($this->container->getParameter('kernel.http_method_override')) {
|
||||||
Request::enableHttpMethodParameterOverride();
|
Request::enableHttpMethodParameterOverride();
|
||||||
}
|
}
|
||||||
|
@ -67,97 +67,10 @@
|
|||||||
<argument type="service" id="form.property_accessor" />
|
<argument type="service" id="form.property_accessor" />
|
||||||
<tag name="form.type" />
|
<tag name="form.type" />
|
||||||
</service>
|
</service>
|
||||||
<service id="form.type.birthday" class="Symfony\Component\Form\Extension\Core\Type\BirthdayType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.checkbox" class="Symfony\Component\Form\Extension\Core\Type\CheckboxType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.choice" class="Symfony\Component\Form\Extension\Core\Type\ChoiceType">
|
<service id="form.type.choice" class="Symfony\Component\Form\Extension\Core\Type\ChoiceType">
|
||||||
<tag name="form.type" />
|
<tag name="form.type" />
|
||||||
<argument type="service" id="form.choice_list_factory"/>
|
<argument type="service" id="form.choice_list_factory"/>
|
||||||
</service>
|
</service>
|
||||||
<service id="form.type.collection" class="Symfony\Component\Form\Extension\Core\Type\CollectionType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.country" class="Symfony\Component\Form\Extension\Core\Type\CountryType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.date" class="Symfony\Component\Form\Extension\Core\Type\DateType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.datetime" class="Symfony\Component\Form\Extension\Core\Type\DateTimeType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.email" class="Symfony\Component\Form\Extension\Core\Type\EmailType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.file" class="Symfony\Component\Form\Extension\Core\Type\FileType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.hidden" class="Symfony\Component\Form\Extension\Core\Type\HiddenType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.integer" class="Symfony\Component\Form\Extension\Core\Type\IntegerType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.language" class="Symfony\Component\Form\Extension\Core\Type\LanguageType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.locale" class="Symfony\Component\Form\Extension\Core\Type\LocaleType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.money" class="Symfony\Component\Form\Extension\Core\Type\MoneyType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.number" class="Symfony\Component\Form\Extension\Core\Type\NumberType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.password" class="Symfony\Component\Form\Extension\Core\Type\PasswordType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.percent" class="Symfony\Component\Form\Extension\Core\Type\PercentType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.radio" class="Symfony\Component\Form\Extension\Core\Type\RadioType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.range" class="Symfony\Component\Form\Extension\Core\Type\RangeType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.repeated" class="Symfony\Component\Form\Extension\Core\Type\RepeatedType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.search" class="Symfony\Component\Form\Extension\Core\Type\SearchType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.textarea" class="Symfony\Component\Form\Extension\Core\Type\TextareaType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.text" class="Symfony\Component\Form\Extension\Core\Type\TextType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.time" class="Symfony\Component\Form\Extension\Core\Type\TimeType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.timezone" class="Symfony\Component\Form\Extension\Core\Type\TimezoneType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.url" class="Symfony\Component\Form\Extension\Core\Type\UrlType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.button" class="Symfony\Component\Form\Extension\Core\Type\ButtonType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.submit" class="Symfony\Component\Form\Extension\Core\Type\SubmitType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.reset" class="Symfony\Component\Form\Extension\Core\Type\ResetType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
<service id="form.type.currency" class="Symfony\Component\Form\Extension\Core\Type\CurrencyType" public="true">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0.</deprecated>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<!-- FormTypeHttpFoundationExtension -->
|
<!-- FormTypeHttpFoundationExtension -->
|
||||||
<service id="form.type_extension.form.http_foundation" class="Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension">
|
<service id="form.type_extension.form.http_foundation" class="Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension">
|
||||||
@ -190,19 +103,5 @@
|
|||||||
<argument type="service" id="translator"/>
|
<argument type="service" id="translator"/>
|
||||||
<argument type="string">%validator.translation_domain%</argument>
|
<argument type="string">%validator.translation_domain%</argument>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="deprecated.form.registry" class="stdClass" public="true">
|
|
||||||
<property name="registry" type="collection">
|
|
||||||
<property type="service" id="form.type_guesser.validator" />
|
|
||||||
<property type="service" id="form.type.choice" />
|
|
||||||
<property type="service" id="form.type.form" />
|
|
||||||
<property type="service" id="form.type_extension.form.http_foundation" />
|
|
||||||
<property type="service" id="form.type_extension.form.validator" />
|
|
||||||
<property type="service" id="form.type_extension.repeated.validator" />
|
|
||||||
<property type="service" id="form.type_extension.submit.validator" />
|
|
||||||
<property type="service" id="form.type_extension.upload.validator" />
|
|
||||||
</property>
|
|
||||||
<deprecated>The service "%service_id%" is internal and deprecated since Symfony 3.3 and will be removed in Symfony 4.0</deprecated>
|
|
||||||
</service>
|
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -16,12 +16,5 @@
|
|||||||
<argument>%validator.translation_domain%</argument>
|
<argument>%validator.translation_domain%</argument>
|
||||||
<argument type="service" id="form.server_params" />
|
<argument type="service" id="form.server_params" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="deprecated.form.registry.csrf" class="stdClass" public="true">
|
|
||||||
<property name="registry" type="collection">
|
|
||||||
<property type="service" id="form.type_extension.csrf" />
|
|
||||||
</property>
|
|
||||||
<deprecated>The service "%service_id%" is internal and deprecated since Symfony 3.3 and will be removed in Symfony 4.0</deprecated>
|
|
||||||
</service>
|
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -5,14 +5,6 @@
|
|||||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||||
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter key="router.options.generator_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
|
|
||||||
<parameter key="router.options.generator_base_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
|
|
||||||
<parameter key="router.options.generator_dumper_class">Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper</parameter>
|
|
||||||
<parameter key="router.options.matcher_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</parameter>
|
|
||||||
<parameter key="router.options.matcher_base_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</parameter>
|
|
||||||
<parameter key="router.options.matcher_dumper_class">Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper</parameter>
|
|
||||||
<parameter key="router.options.matcher.cache_class">%router.cache_class_prefix%UrlMatcher</parameter>
|
|
||||||
<parameter key="router.options.generator.cache_class">%router.cache_class_prefix%UrlGenerator</parameter>
|
|
||||||
<parameter key="router.request_context.host">localhost</parameter>
|
<parameter key="router.request_context.host">localhost</parameter>
|
||||||
<parameter key="router.request_context.scheme">http</parameter>
|
<parameter key="router.request_context.scheme">http</parameter>
|
||||||
<parameter key="router.request_context.base_url"></parameter>
|
<parameter key="router.request_context.base_url"></parameter>
|
||||||
@ -65,14 +57,14 @@
|
|||||||
<argument type="collection">
|
<argument type="collection">
|
||||||
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
||||||
<argument key="debug">%kernel.debug%</argument>
|
<argument key="debug">%kernel.debug%</argument>
|
||||||
<argument key="generator_class">%router.options.generator_class%</argument>
|
<argument key="generator_class">Symfony\Component\Routing\Generator\UrlGenerator</argument>
|
||||||
<argument key="generator_base_class">%router.options.generator_base_class%</argument>
|
<argument key="generator_base_class">Symfony\Component\Routing\Generator\UrlGenerator</argument>
|
||||||
<argument key="generator_dumper_class">%router.options.generator_dumper_class%</argument>
|
<argument key="generator_dumper_class">Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper</argument>
|
||||||
<argument key="generator_cache_class">%router.options.generator.cache_class%</argument>
|
<argument key="generator_cache_class">%router.cache_class_prefix%UrlGenerator</argument>
|
||||||
<argument key="matcher_class">%router.options.matcher_class%</argument>
|
<argument key="matcher_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</argument>
|
||||||
<argument key="matcher_base_class">%router.options.matcher_base_class%</argument>
|
<argument key="matcher_base_class">Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher</argument>
|
||||||
<argument key="matcher_dumper_class">%router.options.matcher_dumper_class%</argument>
|
<argument key="matcher_dumper_class">Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper</argument>
|
||||||
<argument key="matcher_cache_class">%router.options.matcher.cache_class%</argument>
|
<argument key="matcher_cache_class">%router.cache_class_prefix%UrlMatcher</argument>
|
||||||
</argument>
|
</argument>
|
||||||
<argument type="service" id="router.request_context" on-invalid="ignore" />
|
<argument type="service" id="router.request_context" on-invalid="ignore" />
|
||||||
<argument type="service" id="logger" on-invalid="ignore" />
|
<argument type="service" id="logger" on-invalid="ignore" />
|
||||||
|
@ -66,17 +66,6 @@
|
|||||||
<argument type="service" id="cache.serializer" />
|
<argument type="service" id="cache.serializer" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="serializer.mapping.cache.doctrine.apc" class="Doctrine\Common\Cache\ApcCache">
|
|
||||||
<call method="setNamespace">
|
|
||||||
<argument>%serializer.mapping.cache.prefix%</argument>
|
|
||||||
</call>
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.2 and will be removed in 4.0. APCu should now be automatically used when available.</deprecated>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="serializer.mapping.cache.apc" parent="serializer.mapping.cache.doctrine.apc" public="false">
|
|
||||||
<deprecated>The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. APCu should now be automatically used when available.</deprecated>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<!-- Encoders -->
|
<!-- Encoders -->
|
||||||
<service id="serializer.encoder.xml" class="Symfony\Component\Serializer\Encoder\XmlEncoder">
|
<service id="serializer.encoder.xml" class="Symfony\Component\Serializer\Encoder\XmlEncoder">
|
||||||
<tag name="serializer.encoder" />
|
<tag name="serializer.encoder" />
|
||||||
|
@ -55,7 +55,7 @@ class TemplateNameParser extends BaseTemplateNameParser
|
|||||||
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
|
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isAbsolutePath($name) || !preg_match('/^(?:([^:]*):([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) {
|
if (!preg_match('/^(?:([^:]*):([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches) || 0 === strpos($name, '@')) {
|
||||||
return parent::parse($name);
|
return parent::parse($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,15 +71,4 @@ class TemplateNameParser extends BaseTemplateNameParser
|
|||||||
|
|
||||||
return $this->cache[$name] = $template;
|
return $this->cache[$name] = $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isAbsolutePath($file)
|
|
||||||
{
|
|
||||||
$isAbsolute = (bool) preg_match('#^(?:/|[a-zA-Z]:)#', $file);
|
|
||||||
|
|
||||||
if ($isAbsolute) {
|
|
||||||
@trigger_error('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', E_USER_DEPRECATED);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $isAbsolute;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,9 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel;
|
use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Component\Config\ConfigCacheFactory;
|
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\NullOutput;
|
use Symfony\Component\Console\Output\NullOutput;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
|
||||||
|
|
||||||
class CacheClearCommandTest extends TestCase
|
class CacheClearCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -43,10 +40,7 @@ class CacheClearCommandTest extends TestCase
|
|||||||
$this->fs->remove($this->rootDir);
|
$this->fs->remove($this->rootDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testCacheIsCleared()
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
public function testCacheIsFreshAfterCacheClearedWithWarmup()
|
|
||||||
{
|
{
|
||||||
$input = new ArrayInput(array('cache:clear'));
|
$input = new ArrayInput(array('cache:clear'));
|
||||||
$application = new Application($this->kernel);
|
$application = new Application($this->kernel);
|
||||||
@ -54,35 +48,6 @@ class CacheClearCommandTest extends TestCase
|
|||||||
|
|
||||||
$application->doRun($input, new NullOutput());
|
$application->doRun($input, new NullOutput());
|
||||||
|
|
||||||
// Ensure that all *.meta files are fresh
|
$this->assertDirectoryNotExists($this->kernel->getCacheDir());
|
||||||
$finder = new Finder();
|
|
||||||
$metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
|
|
||||||
// simply check that cache is warmed up
|
|
||||||
$this->assertGreaterThanOrEqual(1, count($metaFiles));
|
|
||||||
$configCacheFactory = new ConfigCacheFactory(true);
|
|
||||||
|
|
||||||
foreach ($metaFiles as $file) {
|
|
||||||
$configCacheFactory->cache(substr($file, 0, -5), function () use ($file) {
|
|
||||||
$this->fail(sprintf('Meta file "%s" is not fresh', (string) $file));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// check that app kernel file present in meta file of container's cache
|
|
||||||
$containerRef = new \ReflectionObject($this->kernel->getContainer());
|
|
||||||
$containerFile = $containerRef->getFileName();
|
|
||||||
$containerMetaFile = $containerFile.'.meta';
|
|
||||||
$kernelRef = new \ReflectionObject($this->kernel);
|
|
||||||
$kernelFile = $kernelRef->getFileName();
|
|
||||||
/** @var ResourceInterface[] $meta */
|
|
||||||
$meta = unserialize(file_get_contents($containerMetaFile));
|
|
||||||
$found = false;
|
|
||||||
foreach ($meta as $resource) {
|
|
||||||
if ((string) $resource === $kernelFile) {
|
|
||||||
$found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->assertTrue($found, 'Kernel file should present as resource');
|
|
||||||
$this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', get_class($this->kernel->getContainer())), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -788,21 +788,6 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
|
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @expectedDeprecation The "framework.serializer.cache" option is deprecated %s.
|
|
||||||
*/
|
|
||||||
public function testDeprecatedSerializerCacheOption()
|
|
||||||
{
|
|
||||||
$container = $this->createContainerFromFile('serializer_legacy_cache', array('kernel.debug' => true, 'kernel.container_class' => __CLASS__));
|
|
||||||
|
|
||||||
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
|
|
||||||
$this->assertTrue($container->hasDefinition('serializer.mapping.class_metadata_factory'));
|
|
||||||
|
|
||||||
$cache = $container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1);
|
|
||||||
$this->assertEquals(new Reference('foo'), $cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSerializerMapping()
|
public function testSerializerMapping()
|
||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('serializer_mapping', array('kernel.bundles_metadata' => array('TestBundle' => array('namespace' => 'Symfony\\Bundle\\FrameworkBundle\\Tests', 'path' => __DIR__.'/Fixtures/TestBundle', 'parent' => null))));
|
$container = $this->createContainerFromFile('serializer_mapping', array('kernel.bundles_metadata' => array('TestBundle' => array('namespace' => 'Symfony\\Bundle\\FrameworkBundle\\Tests', 'path' => __DIR__.'/Fixtures/TestBundle', 'parent' => null))));
|
||||||
|
@ -81,29 +81,4 @@ class TemplateNameParserTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->parser->parse('BarBundle:Post:index.html.php');
|
$this->parser->parse('BarBundle:Post:index.html.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
* @dataProvider provideAbsolutePaths
|
|
||||||
* @expectedDeprecation Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.
|
|
||||||
*/
|
|
||||||
public function testAbsolutePathsAreDeprecated($name, $logicalName, $path, $ref)
|
|
||||||
{
|
|
||||||
$template = $this->parser->parse($name);
|
|
||||||
|
|
||||||
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
|
|
||||||
$this->assertSame($logicalName, $template->getLogicalName());
|
|
||||||
$this->assertSame($path, $template->getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function provideAbsolutePaths()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
array('/path/to/section/index.html.php', '/path/to/section/index.html.php', '/path/to/section/index.html.php', new BaseTemplateReference('/path/to/section/index.html.php', 'php')),
|
|
||||||
array('C:\\path\\to\\section\\name.html.php', 'C:path/to/section/name.html.php', 'C:path/to/section/name.html.php', new BaseTemplateReference('C:path/to/section/name.html.php', 'php')),
|
|
||||||
array('C:\\path\\to\\section\\name:foo.html.php', 'C:path/to/section/name:foo.html.php', 'C:path/to/section/name:foo.html.php', new BaseTemplateReference('C:path/to/section/name:foo.html.php', 'php')),
|
|
||||||
array('\\path\\to\\section\\name.html.php', '/path/to/section/name.html.php', '/path/to/section/name.html.php', new BaseTemplateReference('/path/to/section/name.html.php', 'php')),
|
|
||||||
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||||||
*/
|
*/
|
||||||
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
|
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
|
||||||
{
|
{
|
||||||
protected $container;
|
private $container;
|
||||||
protected $validators;
|
private $validators;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
Reference in New Issue
Block a user