Closed tamcy closed 2 years ago
The reproducer for 1 would be
admin.category:
class: App\Admin\CategoryAdmin
arguments: [~, App\Entity\Category, ~]
tags:
- { name: sonata.admin, code: custom_code, manager_type: orm, label: Category }
This is not a big deal, since if you start using the new key code
, model_class
, controller
, you should stop using arguments. But a fix will be accepted.
Fixing (2) in the same PR is ok.
Thank you, then I will a PR that also fixes (2) and (3).
Hi,
I just discovered that additional work is needed to completely resolve the "service id or admin code" problem in the admin pool class, which I overlooked in my previous patch.
The first one is the
$adminClasses
variable of the pool, which serves as the model class name lookup array. The variable is used in places like when building a many_to_one list field. Currently service ids are still wrongly assigned to it byAddDependencyCallsCompilerPass
, which causes the lookup to fail.Before I submit a PR for this, I would like to seek your advice for the following two matters which are also related to
AddDependencyCallsCompilerPass
:$id
in the following code block also needs to be fixed, but I am not 100% sure, and I probably can't provide a useable test case for this one:https://github.com/sonata-project/SonataAdminBundle/blob/1b919ccc08e3e924dbd4857756bf238f2909b593/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php#L109-L119
Please advice if I should also change the
$id
to$code
in the PR.Thank you!