| Question | Answer |
| --- | --- |
| Bundle version | sonata-project/admin-bundle 3.1.0 |
| Symfony version | symfony/symfony v3.1.0 |
| php version | irrelevant |
The Sonata\AdminBundle\Admin\AdminExtension class is deprecated since version 3.1
and will be removed in 4.0.
Use Sonata\AdminBundle\Admin\AbstractAdminExtension instead.
This deprecation notice appear in the profiler toolbar and functional tests. For that reason travis are failing all my functional tests.
The problem
Currently i'm using the admin AbstractAdminExtension but the message still.
I see the following error:
The class is still loading in the autoloader, because that is mapped in:
_\Sonata\AdminBundle\DependencyInjection\SonataAdminExtension_
public function configureClassesToCompile()
{
$this->addClassesToCompile(array(
'Sonata\\AdminBundle\\Admin\\AbstractAdmin',
'Sonata\\AdminBundle\\Admin\\AdminExtension',
'Sonata\\AdminBundle\\Admin\\AdminExtensionInterface',
A solution can be, move the deprecation notice to the admin extension constructor keeping BC
Thanks for the report @rafrsr!
I'll take a look.
A similar error happend with Sonata\CoreBundle\Component\NativeSlugify this file is marked as deprecated. However has a service called 'sonata.core.slugify.native`. When the container builder process all services defintions automatically load this file.
The entire deprecation message
The Sonata\CoreBundle\Component\NativeSlugify class is deprecated since version 2.3 and will be removed in 3.0. Hide stack trace
require_once() (called from DebugClassLoader.php at line 142)
DebugClassLoader::loadClass()
spl_autoload_call()
class_exists() (called from PointcutMatchingPass.php at line 116)
PointcutMatchingPass::processDefinition() (called from PointcutMatchingPass.php at line 65)
PointcutMatchingPass::process() (called from Compiler.php at line 104)
Compiler::compile() (called from ContainerBuilder.php at line 545)
ContainerBuilder::compile() (called from AppKernel.php at line 116)
AppKernel::initializeContainer() (called from Kernel.php at line 117)
Kernel::boot() (called from Kernel.php at line 166)
Kernel::handle() (called from app_dev.php at line 30)
as the above, the deprecation message should be placed in the class constructor, and only triggered on class usage, keeping BC and not showing a false positive warning.
+1
Stop +1 on issue/PR. You have emoji reaction for that.
as the above, the deprecation message should be placed in the class constructor, and only triggered on class usage, keeping BC and not showing a false positive warning.
We can't do that. If you use a constant of the deprecated class for example, the warning will never be deprecated.
@rande, in https://github.com/sonata-project/SonataAdminBundle/commit/4c019921f64711b5fdc5e6232ecce477febc6a8f, you added the Extension::addClassesToCompile method.
Never see this usage on any bundles yet. What is the purpose of this? Is this still needed? This seems to be the reason of this error...
cc @sonata-project/contributors
I think it's for speed, and in that case, how about just removing line 134 replacing line 134 with AbstractAdmin ?
I think it's for speed
Quite weird to have it under package part. For some website running with opcache for example, this is useless, isn't it?
and in that case, how about just removing line 134 ?
Yes, will try that.
For some website running with opcache for example, this is useless, isn't it?
I think so
and in that case, how about just removing line 134 ?
Make sure you replace it instead (consistency, etc…)
Most helpful comment
+1