Not implementing getFormOptions()
is deprecated, it will replace the getRenderSettings()
in next major. If you have an implementation this way:
public function getRenderSettings(): array
{
return [DefaultType::class, [
'operator_type' => $this->getOption('operator_type'),
'operator_options' => $this->getOption('operator_options'),
'field_type' => $this->getFieldType(),
'field_options' => $this->getFieldOptions(),
'label' => $this->getLabel(),
]];
}
You can implement the getFormOptions()
method this way:
public function getFormOptions(): array
{
return [
'operator_type' => $this->getOption('operator_type'),
'operator_options' => $this->getOption('operator_options'),
'field_type' => $this->getFieldType(),
'field_options' => $this->getFieldOptions(),
'label' => $this->getLabel(),
];
}
Deprecate batchAction%sIsRelevant
hook. You must handle the specific logic in your
batch action controller directly.
Datetime picker assets were moved from SonataAdminBundle to form-extensions.
Normally this should not affect you, unless you have modified
the default javascript and/or stylesheets
(remember that you can also add extra stylesheets or javascript using
extra_stylesheets
and extra_javascripts
to avoid this kind of issues):
Before
sonata_admin:
assets:
javascript:
bundles/sonataadmin/app.js
your_own.js
stylesheets:
bundles/sonataadmin/app.css
your_own.css
After
sonata_admin:
assets:
javascript:
bundles/sonataadmin/app.js
bundles/sonataform/app.js
your_own.js
stylesheets:
bundles/sonataadmin/app.css
bundles/sonataform/app.css
your_own.css
Deprecate passing the code, the model class and the controller in the arguments section.
Before
services:
app.admin.car:
class: App\Admin\CarAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: Demo, label: Car }
arguments:
- admin_car
- App\Entity\Car
- App\Controller\CarAdminController
After
services:
app.admin.car:
class: App\Admin\CarAdmin
tags:
- { name: sonata.admin, code: admin_car, model_class: App\Entity\Car, controller: App\Controller\CarAdminController, manager_type: orm, group: Demo, label: Car }
In a child admin, if you were overriding createNewInstance
and relying on sonata to provide the needed "parent" entity
to the instance, now you have to call appendParentObject
manually.
Before:
final class PostAdmin extends AbstractAdmin
{
public function createNewInstance(): object
{
return new Post();
}
}
After:
final class PostAdmin extends AbstractAdmin
{
public function createNewInstance(): object
{
$object = new Post();
// set the post author if the parent admin is "AuthorAdmin"
$this->appendParentObject($object);
return $object;
}
}