Using @ParamConverter annotation to fetch an admin service is deprecated and will not work in version 4.0. Instead,
you MUST type-hint with the appropriate admin class.
The Sonata\AdminBundle\Request\ParamConverter\AdminParamConverter class has been deprecated.
Before:
final class MyController
{
/**
* @ParamConverter("admin", class="App\Admin\MyAdmin")
*/
public function custom($admin): Response
{
return new Response();
}
}After:
use App\Admin\MyAdmin;
final class MyController
{
public function custom(MyAdmin $admin): Response
{
return new Response();
}
}"or_group" option is not set anymore to filters implementing Sonata\AdminBundle\Filter\ChainableFilterInterface.
If you are using custom filters and want to use them in the search, you SHOULD implement
this interface on each one.
We used multiple icon option with different format:
<i class="fa fa-plus"></i>fa fa-plusfa-plusplus
The last two format are now deprecated. Since we've fixed the deprecation in the code,
if you've overriden some template, be sure to always render the icons with the new parse_icon filter.
Deprecated passing collection as argument 2 for FormMapper::add() method. You MUST pass
Symfony\Component\Form\Extension\Core\Type\CollectionType or Sonata\AdminBundle\Form\Type\CollectionType instead.
This variable will not be used anymore for creating breadcrumbs, you MUST decorate or override
sonata.admin.breadcrumbs_builder service instead.
Admin-lte was upgraded from 2.3.x to 2.4.x. There are a few BC breaks related to some classes and data-attributes.
Please, make sure you follow this guide if you were overriding Sonata default templates before upgrading: https://adminlte.io/docs/2.4/upgrade-guide
One of the most important ones is the data-toggle for the sidebar menu. Before we used offcanvas and now it is using push-menu, If you are overriding the standard-layout.html.twig you might be affected by this change.
All Compiler Passes will be internal in version 4.0 and they will not be covered by our BC promise.
These service aliases have been deprecated:
Sonata\AdminBundle\Command\ExplainAdminCommandSonata\AdminBundle\Command\GenerateObjectAclCommandSonata\AdminBundle\Command\ListAdminCommandSonata\AdminBundle\Command\SetupAclCommandSonata\AdminBundle\Admin\AdminHelperSonata\AdminBundle\Admin\BreadcrumbsBuilderSonata\AdminBundle\Event\AdminEventExtensionSonata\AdminBundle\Filter\FilterFactorySonata\AdminBundle\Filter\Persister\SessionFilterPersisterSonata\AdminBundle\Model\AuditManagerSonata\AdminBundle\SonataConfigurationSonata\AdminBundle\Search\SearchHandlerSonata\AdminBundle\Templating\TemplateRegistrySonata\AdminBundle\Translator\BCLabelTranslatorStrategySonata\AdminBundle\Translator\Extractor\AdminExtractorSonata\AdminBundle\Translator\FormLabelTranslatorStrategySonata\AdminBundle\Translator\NativeLabelTranslatorStrategySonata\AdminBundle\Translator\NoopLabelTranslatorStrategySonata\AdminBundle\Translator\UnderscoreLabelTranslatorStrategy
- Deprecated constructing it passing more than one argument.
- Deprecated
Sonata\AdminBundle\Route\AdminPoolLoaderservice alias.
If you are using autoconfiguration,
all the services implementing Sonata\AdminBundle\Model\AuditReaderInterface will
be automatically tagged. Otherwise, you MUST tag them explicitly.
Before:
<service id="sonata.admin.audit_reader.custom" class="App\Model\AuditReader">
<!-- ... -->
</service>After:
<service id="sonata.admin.audit_reader.custom" class="App\Model\AuditReader">
<!-- ... -->
<tag name="sonata.admin.audit_reader"/>
</service>Deprecated passing a value which is not registered as a service as argument 2 for create() method.
Deprecated AbstractAdmin::getSideMenu()
Deprecated AbstractAdmin::getTabMenu()
Use Sonata\AdminBundle\FieldDescription\BaseFieldDescription instead.
Use Sonata\AdminBundle\FieldDescription\FieldDescriptionCollection instead.
Use Sonata\AdminBundle\FieldDescription\FieldDescriptionInterface instead.
Use Sonata\AdminBundle\FieldDescription\FieldDescriptionRegistryInterface instead.
Override Sonata\AdminBundle\Admin\AbstractAdmin::configureActionButtons() instead.
Use Sonata\AdminBundle\Model\ModelManagerInterface::reverseTransform() instead.
Use Sonata\AdminBundle\Admin\AdminInterface::hasAccess() instead.
- Deprecated route parameter "base_revision" in favor of "baseRevision";
- Deprecated route parameter "compare_revision" in favor of "compareRevision".
Before:
$admin->generateObjectUrl('history_compare_revisions', $subject, [
'base_revision' => $currentRev,
'compare_revision' => $rev,
]);After:
$admin->generateObjectUrl('history_compare_revisions', $subject, [
'baseRevision' => $currentRev,
'compareRevision' => $rev,
]);Use Sonata\AdminBundle\FieldDescription\TypeGuesserInterface interface instead.
Use Sonata\AdminBundle\FieldDescription\TypeGuesserChain class instead.
Use Sonata\AdminBundle\Admin\AbstractAdmin::createNewInstance() method instead.
This method has been deprecated in favor of FieldFactoryInterface::create().
Use AbstractAdmin::alterNewInstance() instead.
Before:
use Sonata\AdminBundle\Admin\AbstractAdmin;
final class MyAdmin extends AbstractAdmin
{
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper->add('foo', null, [], MyFormType::class, ['foo' => 'bar']);
}
}After
use Sonata\AdminBundle\Admin\AbstractAdmin;
final class MyAdmin extends AbstractAdmin
{
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper->add('foo', null, [
'field_type' => MyFormType::class,
'field_options' => ['foo' => 'bar'],
]);
}
}Use the accessor option instead.
This property has been replaced by the new method Sonata\AdminBundle\Admin\AbstractAdmin::configureFormOptions()
Before:
use Sonata\AdminBundle\Admin\AbstractAdmin;
final class MyAdmin extends AbstractAdmin
{
protected $formOptions = [
'validation_groups' => ['Default', 'MyAdmin'],
];
}After:
use Sonata\AdminBundle\Admin\AbstractAdmin;
final class MyAdmin extends AbstractAdmin
{
protected function configureFormOptions(array &$formOptions): void
{
$formOptions['validation_groups'] = ['Default', 'MyAdmin'];
}
}This method has been deprecated without replacement.
We recommend using a specific filter for null values instead.
- Deprecated
SonataAdminExtension::MOMENT_UNSUPPORTED_LOCALESconstant. - Deprecated
SonataAdminExtension::setXEditableTypeMapping()method. - Deprecated
SonataAdminExtension::getXEditableType()method. - Deprecated
SonataAdminExtension::getXEditableChoices()method. - Deprecated
SonataAdminExtension::getCanonicalizedLocaleForMoment()method in favor ofCanonicalizerExtension::getCanonicalizedLocaleForMoment(). - Deprecated
SonataAdminExtension::getCanonicalizedLocaleForSelect2()method in favor ofCanonicalizerExtension::getCanonicalizedLocaleForSelect2(). - Deprecated
SonataAdminExtension::isGrantedAffirmative()method in favor ofSecurityExtension::isGrantedAffirmative(). - Deprecated
SonataAdminExtension::renderListElement()method in favor ofRenderElementExtension::renderListElement(). - Deprecated
SonataAdminExtension::renderViewElement()method in favor ofRenderElementExtension::renderViewElement(). - Deprecated
SonataAdminExtension::renderViewElementCompare()method in favor ofRenderElementExtension::renderViewElementCompare(). - Deprecated
SonataAdminExtension::renderRelationElement()method in favor ofRenderElementExtension::renderRelationElement(). - Deprecated
SonataAdminExtension::getTemplate()method. - Deprecated
SonataAdminExtension::getTemplateRegistry()method.
Deprecated getResults() method in favor of getCurrentPageResults().
Deprecated getNbResults() method in favor of countResults().
Deprecated $nbResults property, getNbResults() and setNbResults() methods.
They have been moved to Sonata\AdminBundle\Admin\FieldDescriptionInterface.
Deprecated configure() method for configuring the associated admin, you MUST call configureAdmin() method instead.
Sonata\AdminBundle\Admin\Pool::setAdminServiceIds()method has been deprecated. You MUST pass service ids as argument 2 to the constructor.Sonata\AdminBundle\Admin\Pool::setAdminGroups()method has been deprecated. You MUST pass admin groups as argument 3 to the constructor.Sonata\AdminBundle\Admin\Pool::setAdminClasses()method has been deprecated. You MUST pass admin classes as argument 4 to the constructor.
BaseFieldDescription::getFieldValue() will become protected.
In 4.0, AbstractAdmin::configureRoutes and AdminExtensionInterface::configureRoutes will receive a
RouteCollectionInterface instance instead of a RouteCollection instance, you can update your code before ugprading
to 4.0.
Before:
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Route\RouteCollection;
final class MyAdmin extends AbstractAdmin
{
protected function configureRoutes(RouteCollection $collection): void
{
$collection->add('my_route');
}
}After:
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Route\RouteCollectionInterface;
final class MyAdmin extends AbstractAdmin
{
protected function configureRoutes(RouteCollectionInterface $collection): void
{
$collection->add('my_route');
}
}This only will work with PHP >= 7.4, where fully support to contravariance was added.
Method __construct() has been updated to receive the field name as argument 6:
public function __construct(
?string $name = null,
array $options = [],
array $fieldMapping = [],
array $associationMapping = [],
array $parentAssociationMappings = [],
?string $fieldName = null
) {Deprecated Sonata\AdminBundle\Admin\BaseFieldDescription::setFieldName().
Deprecated admin_pool parameter in sonata.admin.dashboard.top and sonata.admin.dashboard.bottom block events.
This parameter will be removed in 4.0. If you are using it, you SHOULD inject Pool service instead.
This variable has been deprecated in favor of sonata_config variable.
This class has been deprecated without replacement.
Argument 2 of Sonata\AdminBundle\Model\ModelManagerInterface::createQuery() method has been removed.
Sonata\AdminBundle\Admin\Pool::getTitle()method has been deprecated. UseSonata\AdminBundle\SonataConfiguration::getTitle()instead.Sonata\AdminBundle\Admin\Pool::getTitleLogo()method has been deprecated. UseSonata\AdminBundle\SonataConfiguration::getLogo()instead.Sonata\AdminBundle\Admin\Pool::getOption()method has been deprecated. UseSonata\AdminBundle\SonataConfiguration::getOption()instead.Sonata\AdminBundle\Admin\Pool::getGroups()method has been deprecated.Sonata\AdminBundle\Admin\Pool::hasGroup()method has been deprecated.Sonata\AdminBundle\Admin\Pool::getAdminsByGroup()method has been deprecated.
Deprecate Sonata\AdminBundle\Filter\Filter::setValue() and Sonata\AdminBundle\Filter\Filter::getValue()
without replacement.
The implementation of the method Sonata\AdminBundle\Filter\Filter::isActive() will change from
public function isActive()
{
$values = $this->value;
return isset($values['value']) && false !== $values['value'] && '' !== $values['value'];
}
to
public function isActive()
{
return $this->active;
}
in next major. Currently we are supporting both properties so you SHOULD start using $this->active.
The following methods have been deprecated from the interface and will be added as abstract methods to
Sonata\AdminBundle\Admin\BaseFieldDescription in the next major version:
setFieldMapping()setAssociationMapping()setParentAssociationMappings()setMappingType()
Constructor has been modified to allow 3 more parameters
($fieldMapping, $associationMapping and $parentAssociationMapping):
public function __construct(
?string $name = null,
array $options = [],
array $fieldMapping = [],
array $associationMapping = [],
array $parentAssociationMappings = []
) {Deprecated Sonata\AdminBundle\Admin\BaseFieldDescription::setMappingType().
Deprecated AdminInterface::getValidator() and AdminInterface::setValidator() methods, AbstractAdmin::$validator property.
Methods are deprecated without replacement.
Argument 2 of Sonata\AdminBundle\Model\ModelManagerInterface::createQuery() method has been removed.
- Passing a
Symfony\Component\PropertyAccess\PropertyAccessorInterfaceinstance as 4 argument instantiatingSonata\AdminBundle\Admin\Poolis deprecated. Sonata\AdminBundle\Admin\Pool::getPropertyAccessor()method has been deprecated. You SHOULD injectSymfony\Component\PropertyAccess\PropertyAccessorInterfacewhere is needed.
Not passing a Symfony\Component\PropertyAccess\PropertyAccessorInterface instance as argument 5 instantiating
Sonata\AdminBundle\Action\SetObjectFieldValueAction is deprecated.
Not passing a Symfony\Component\PropertyAccess\PropertyAccessorInterface instance as argument 1 instantiating
Sonata\AdminBundle\Admin\AdminHelper is deprecated.
Argument 5 of Sonata\AdminBundle\Admin\SonataAdminExtension constructor SHOULD be a
Symfony\Component\PropertyAccess\PropertyAccessorInterface instance and argument 6 SHOULD be a
Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface instance or "null".
Not passing the empty_boxes option as argument 4 to Sonata\AdminBundle\Block\AdminSearchBlockService() is deprecated.
Use Symfony\Component\Validator\Validation::validate() instead.
This method has been deprecated without replacement.
This method has been deprecated without replacement.
Added "Not equal" in the default list for "choices" option in order to allow filtering by strings that are not equal to the model data.
This method has been deprecated without replacement.
The Sonata\AdminBundle\Templating\TemplateRegistry class has been splitted into 3 classes:
TemplateRegistry, implementingSonata\AdminBundle\Templating\TemplateRegistryInterfaceMutableTemplateRegistry, implementingSonata\AdminBundle\Templating\MutableTemplateRegistryInterfaceAbstractTemplateRegistry, implementingSonata\AdminBundle\Templating\TemplateRegistryInterface. You MUST extend this class if you want to create your own template registry.
The interface Sonata\AdminBundle\Templating\TemplateRegistryAwareInterface was updated in order to handle instances of TemplateRegistryInterface.
The interface Sonata\AdminBundle\Templating\MutableTemplateRegistryAwareInterface was added to provide a simple contract for classes depending on a MutableTemplateRegistryInterface.
TemplateRegistry will stop implementing MutableTemplateRegistryInterface in version 4.0. If you are using setTemplate() or setTemplates() methods, you MUST use MutableTemplateRegistry instead.
This interface has been deprecated without replacement.
ModelManagerInterface::getDefaultSortValues() won't be used anymore.
Empty values are passed to datagrid filters. If you have custom datagrid filters, you MUST add empty string checks to them.
->add('with_open_comments', CallbackFilter::class, [
'callback' => static function (ProxyQueryInterface $query, string $alias, string $field, array $value): bool {
if (!$value['value']) {
return false;
}
$query
->leftJoin(sprintf('%s.comments', $alias), 'c')
->andWhere('c.moderation = :moderation')
->setParameter('moderation', CommentModeration::APPROVED);
return true;
},
'field_type' => CheckboxType::class,
]);The !$value['value'] check is required to avoid the filtering by '' if you didn't used the filter.
As replacement, you MUST inject an instance of Sonata\AdminBundle\Exporter\DataSourceInterface in your admin. This way, the method DataSourceInterface::createIterator() will be used instead.
Setting a DataSourceInterface instance in your admin will be mandatory in version 4.0.
In version 3.77, the shortcut notation for model class names (AppBundle:User)
has been deprecated in favor of its FQCN (App\Model\User) when passing user_model
option to sonata:admin:generate-object-acl command, so this method SHOULD not
be called if that deprecation is addressed.
Deprecated not configuring acl_user_manager and using ACL security handler when friendsofsymfony/user-bundle is installed.
If you are using friendsofsymfony/user-bundle and using ACL security handler, you MUST explicitly configure the acl_user_manager.
sonata_admin:
security:
acl_user_manager: App\Manager\AclFOSUserManager # this service MUST implement "AdminAclUserManagerInterface"Deprecated configuring acl_user_manager with a service that does not implement AdminAclUserManagerInterface.
Given this configuration:
sonata_admin:
security:
acl_user_manager: 'App\Manager\AclUserManager'App\Manager\AclUserManager MUST implement AdminAclUserManagerInterface, if you are using fos_user_manager, this could
be an example:
<?php
namespace App\Manager;
use FOS\UserBundle\Model\UserManagerInterface;
use Sonata\AdminBundle\Util\AdminAclUserManagerInterface;
final class AclUserManager implements AdminAclUserManagerInterface
{
/**
* @var UserManagerInterface
*/
private $userManager;
public function __construct(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}
public function findUsers(): iterable
{
return $this->userManager->findUsers();
}
}This method has been deprecated without replacement.
Deprecated using shortcut notation when specifying the user_model option in sonata:admin:generate-object-acl command.
The shortcut notation (AppBundle:User) has been deprecated in favor of the FQCN (App\Model\User) when passing
user_model option to sonata:admin:generate-object-acl command.
This method has been deprecated without replacement.
This method has been deprecated without replacement.
Sonata\AdminBundle\Controller\CRUDController::getRestMethod() method is deprecated.
Use Symfony\Component\HttpFoundation\Request::getMethod() instead.
Use:
new \Doctrine\Common\Collections\ArrayCollection()instead ofgetModelCollectionInstance($class)$collection->removeElement($element)instead ofcollectionRemoveElement($collection, $element)$collection->add($element)instead ofcollectionAddElement($collection, $element)$collection->contains($element)instead ofcollectionHasElement($collection, $element)$collection->clear()instead ofcollectionClear($collection)
Use Sonata\AdminBundle\Datagrid\ProxyQueryInterface::execute instead.
src/Resources/views/CRUD/base_filter_field.html.twigsrc/Resources/views/CRUD/base_inline_edit_field.html.twigsrc/Resources/views/CRUD/base_standard_edit_field.html.twigsrc/Resources/views/CRUD/edit_array.html.twigsrc/Resources/views/CRUD/edit_boolean.html.twigsrc/Resources/views/CRUD/edit_file.html.twigsrc/Resources/views/CRUD/edit_integer.html.twigsrc/Resources/views/CRUD/edit_sonata_type_immutable_array.html.twigsrc/Resources/views/CRUD/edit_string.html.twigsrc/Resources/views/CRUD/edit_text.html.twig
You MUST use Symfony's help option instead.
Before:
$formMapper
->add('field', null, [], [
'help' => 'Help text <small>Please!</small>',
])
->add('field2')
->addHelp('field2', 'This field is required.')
->add('field3')
->setHelps([
'field3' => 'Great day to great work!',
]);After:
$formMapper
->add('field', null, [
'help' => 'Help text <small>Please!</small>',
'help_html' => true,
])
->add('field2', null, [
'help' => 'This field is required.'
])
->add('field3', null, [
'help' => 'Great day to great work!'
]);We added compatibility with SonataBlockBundle 4.0, make sure you are explicitly declaring your dependency
with sonata-project/block-bundle on your composer.json in order to avoid unwanted upgrades.
There is a minimal BC Break on AdminListBlockService, AdminSearchBlockService and AdminStatsBlockService. If you are extending those clases (keep in mind that they will become final on 4.0) you should add return type hints to execute() and configureSettings().
Deprecated passing callable that does not return Symfony\Component\Routing\Route as $element (2nd argument) to Sonata\AdminBundle\Route\RouteCollection::addElement($code, $element)
When calling a Sonata\AdminBundle\Route\RouteCollection::addElement($code, $element), please pass $element of type Route|callable():Route. Passing callable that returns non instance of Route is deprecated.
Use Sonata\AdminBundle\Admin\AdminInterface::getParentFieldDescription instead.
Use
$instance = $fieldDescription->getAssociationAdmin()->getNewInstance();
SonataAdminBundle\Manipulator\ObjectManipulator::setObject($instance, $object, $fieldDescription);
Instead of
$this->adminHelper->addNewInstance($object, $fieldDescription);
The static method setObject() avoids the need to inject the admin helper dependency,
and adds more flexibility with the instance you're adding to the object.
This filter has been deprecated in favor of the u filter:
Use Symfony\Component\String\UnicodeString instead.
You can use TemplateRegistry constants, like
$showMapper->add('foo', TemplateRegistry::TYPE_STRING)
instead of using directly a string value.
$showMapper->add('foo', 'string')
The list of available types can be found in the documentation.
text: deprecated in favor ofTemplateRegistry::TYPE_STRINGdecimal: deprecated in favor ofTemplateRegistry::TYPE_FLOATsmallint: deprecated in favor ofTemplateRegistry::TYPE_INTEGERbigint: deprecated in favor ofTemplateRegistry::TYPE_INTEGER
Before:
$showMapper->add('nonExistingField');
$listMapper->add('nonExistingField');was displaying nothing in the list and the show views without any warning or error.
But
$formMapper->add('nonExistingField');was throwing an exception.
In the next major an exception will be thrown if no getter/isser/hasser is found for the property. Since most of the time the error is coming from a typo, this will allow the developer to catch it as fast as possible. Currently this will only trigger a deprecation if the field value is not found.
Deprecated not passing a Sonata\AdminBundle\Admin\AdminHelper instance to Sonata\AdminBundle\Form\Type\AdminType::__construct()
When instantiating a Sonata\AdminBundle\Form\Type\AdminType object, please use the 1 parameter signature ($adminHelper).
Deprecated not setting as false the configuration option sonata_admin.options.legacy_twig_text_extension
This option controls which Twig text extension will be used to provide filters like
truncate or wordwrap.
The legacy behavior is provided by the abandoned package "twig/extensions",
while the new implementation is based on "twig/string-extra".
Its default value is true in order to keep the legacy behavior. You should set
it to false in order to get the behavior which will be used by default at 4.0.
sonata_admin:
options:
legacy_twig_text_extension: falseYou should use the truncate.separator and truncate.cut options instead. Unlike
truncate.preserve, truncate.cut has false as its default value and the opposite
behavior:
Before:
$showMapper
->add('field', null, [
'truncate' => [
'preserve' => true,
'separator' => '...',
],
])
;After:
$showMapper
->add('field', null, [
'truncate' => [
'cut' => false,
'ellipsis' => '...',
],
])
;If you are using autoconfiguration,
all the services implementing Sonata\AdminBundle\Model\ModelManagerInterface will
be automatically tagged. Otherwise, you must tag them explicitly.
Before:
<service id="sonata.admin.manager.custom" class="App\Model\ModelManager">
<!-- ... -->
</service>After:
<service id="sonata.admin.manager.custom" class="App\Model\ModelManager">
<!-- ... -->
<tag name="sonata.admin.manager"/>
</service>You should use Symfony's help option instead.
Before:
$formMapper
->add('field', null, [
'sonata_help' => 'Help text',
])
;After:
$formMapper
->add('field', null, [
'help' => 'Help text',
])
;Before:
$datagridMapper
->add('field', 'filter_type')
;After:
use App\Filter\FilterType;
$datagridMapper
->add('field', FilterType::class)
;If you extended that controller, you should split your extended controller and
extend the corresponding classes in SonataAdminBundle\Action\.
If you need to style headers prefer to use CSS classes and not in the html DOM.
In this case please use header_class option.
When calling SimplePager::getResults() on non-empty result which has set $maxPerPage, Collection would be returned instead of array as it is declared in PagerInterface. Update usage of SimplePager::getResults(), ensure you are transforming Collection to array and you aren't dealing with any of its methods.
// will return Collection on non-empty result and array on empty result
$results = $pager->getResults();
if ($results instanceof ArrayCollection) {
$results = $results->toArray();
}
Admin classes can now have multiple parents, when registering the service you should pass a field name:
<service id="sonata.admin.playlist" class="App\Admin\PlaylistAdmin">
<!-- ... -->
<call method="addChild">
<argument type="service" id="sonata.admin.video" />
<argument>playlist</argument>
</call>
</service>Overwriting $parentAssociationMapping is discouraged.
Deprecated calling of AbstractAdmin::addChild without second argument.
The AbstractAdmin::$templates attribute and the methods getTemplate() and
getTemplates() are deprecated. Please use the new TemplateRegistry services
instead. One per admin is generated and available through the admin code +
.template_registry (for example, app.admin.news uses app.admin.news.template_registry).
The Pool::$templates attribute and the methods getTemplate(), getTemplates()
and setTemplates() are deprecated. Please use the TemplateRegistry service
sonata.admin.global_template_registry instead.
The Twig function get_admin_pool_template() is deprecated. Please use
get_global_template() instead.
The AbstractAdmin::$persistFilters is deprecated and should not be used anymore.
The problem was that it was not easy to change the way filters are persisted.
Instead of a simple boolean var (whether to persist or not filters) you can now inject a service,
that will be responsible for doing the job (see FilterPersisterInterface).
An implementation was added, which falls back to the previous behavior : SessionFilterPersister.
This is not allowed anymore and will throw a 404 error in the future.
The SonataAdminExtension::output() method is deprecated and should not be
used anymore.
The AdminVoter::setRequest is deprecated and should not be used anymore.
This method was inconsistent with the structure of AbstractAdmin::$subClasses,
which is supposed to contain a hash that associates aliases with FQCNs. Use AbstractAdmin::setSubClasses instead.
The feature provided by this class was replaced with something much more simple, and you should not rely on it anymore,
as well as on the sonata.admin.menu.matcher.voter.children service.
Call CRUDController::renderWithExtraParams() instead.
The AbstractAdmin::baseCodeRoute property is no longer supported.
Please use the AbstractAdmin::getBaseCodeRoute() method instead.
The AbstractAdmin::setBaseCodeRoute() method is no longer supported.
There is no replacement for this method.
You can still use the AbstractAdmin::setCode() method to set the code
of an admin.
sonata:admin:generate was based on the SensioGeneratorBundle, which is
incompatible with Symfony 4 and is no longer maintained. Please use
make:sonata:admin instead.
The ModelChoiceList class is no longer supported. Please use the ModelChoiceLoader class instead.
The ModelChoiceList is usually used on the choice_list
option of a FormBuilder. The ModelChoiceLoader class must be replaced on the
choice_loader option.
Starting with version 4.0, SonataAdminBundle will no longer register annotations with JMSDiExtraBundle automatically. Please add the following to your config.yml to register the annotations yourself:
jms_di_extra:
annotation_patterns:
- JMS\DiExtraBundle\Annotation
- Sonata\AdminBundle\AnnotationThe sonata.admin.exporter is deprecated in favor of the sonata.exporter.exporter service.
To make this service available, you have to install sonata-project.exporter ^1.7
and enable the bundle as described in the documentation.
When instantiating a ModelsToArrayTransformer object, please use the 2 parameter signature ($modelManager, $class).
Please use Pager::getFirstIndex() and Pager::getLastIndex() instead!
Passing no 3rd argument to Menu\Provider\GroupMenuProvider is deprecated.
Pass Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface as 3rd argument.
The $translator property and the corresponding methods (setTranslator, getTranslator, trans and transChoice) in AbstractAdmin are deprecated.
Please use CRUDController::trans or twig templates instead.
The $container property in Twig/GlobalVariables is deprecated.
The Sonata\AdminBundle\Form\Type\ModelTypeList class is now deprecated.
Use Sonata\AdminBundle\Form\Type\ModelListType instead.
All files under the Tests directory are now correctly handled as internal test classes.
You can't extend them anymore, because they are only loaded when running internal tests.
More information can be found in the composer docs.
The $context argument is deprecated and will be removed.
Instead of relying on it (and using a switch statement),
rely on an abstraction, and inject different implementations of this abstraction in different actions.
Here is an example.
Since AbstractAdmin::configureBatchActions is present, you should not override AbstractAdmin::getBatchActions.
This method will be final in 4.0.
Now AbstractAdmin::getSubject() return null or object of subject entity. Previously,
AbstractAdmin::getSubject() may return false if entity identifier not match regexp /^[0-9A-Fa-f\-]+$/.
The Admin class is deprecated. Use AbstractAdmin instead.
The AdminExtension class is deprecated. Use AbstractAdminExtension instead.
The Twig extension method that fallback to a default template when the specified one does not exist. You can no longer rely on that and should always specify templates that exist.
buildBreadcrumbsis deprecated, and no replacement is given, it will become an internal method.getBreadcrumbsis deprecated in favor of the homonym method of thesonata.admin.breadcrumbs_builderservice.- The breadcrumbs builder accessors are deprecated,
the
sonata.admin.breadcrumbs_builderservice should be used directly instead.