Closed soullivaneuh closed 3 years ago
It's look like the model_manager
option is not automatically provided anymore. Before I have:
ModelManager {#5224 ▼
#registry: Registry {#709 ▶}
#cache: array:25 [▶]
}
No I have null
.
Did a dump
here:
class ModelAutocompleteType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
dump($options['model_manager']);
v3.51.0
to v3.66.0
is a big update @soullivaneuh.
Can you make smaller update in order to get the BC-break release ?
@VincentLanglet Maybe a big update, but it should BC as it is just minors. ;-)
I'm currently investigating, but I have nothing more to offer for now.
Well, if I put back only this bundle to its original version (3.51.0
), I still have the error.
Looks like the issue come from somewhere else. Maybe core-bundle? Did you remember any change about dependency injection on the sonata ecosystem?
Found the faulty one: sonata-project/doctrine-orm-admin-bundle
Rolling back from 3.14.0 to 3.11.0 resolve the issue. Start bisecting.
Issue happens starting 3.13.0
.
After bisecting, it appears the bug was introduced in 3bef7482ae58f0cd1e858d28516bbe6e62c67d13, related to #945
Ok found why: I was sill using doctrine_orm_model_autocomplete
somewhere and this type is not supported anymore. Here is my code fix:
❯ gd src/
diff --git a/src/Admin/Extension/AutoFieldsAdminExtension.php b/src/Admin/Extension/AutoFieldsAdminExtension.php
index b0f1f1029..2f9fc110c 100644
--- a/src/Admin/Extension/AutoFieldsAdminExtension.php
+++ b/src/Admin/Extension/AutoFieldsAdminExtension.php
@@ -17,6 +17,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Sonata\AdminBundle\Admin\AbstractAdminExtension;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
+use Sonata\DoctrineORMAdminBundle\Filter\ModelAutocompleteFilter;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Webmozart\Assert\Assert;
@@ -57,7 +58,7 @@ final class AutoFieldsAdminExtension extends AbstractAdminExtension
}
if ($targetEntity === Hosting::class) {
- $datagridMapper->add($fieldName, 'doctrine_orm_model_autocomplete', [], null, [
+ $datagridMapper->add($fieldName, ModelAutocompleteFilter::class, [], null, [
'property' => 'name',
]);
}
Introduced here: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/commit/3bef7482ae58f0cd1e858d28516bbe6e62c67d13#diff-eeb9e64780aabe9b2d7d6de3f0522447R159
To me, even if dropping version support is BC, making code not working anymore is not.
The old syntax should be still supported until a new major is coming.
I let you decide of what to do now.
Introduced back here: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/commit/5ede9a3239510249af997b65d6ab328551694934#diff-7d465efca2ece4545e7c9e9072a77b27
Removed again here: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/commit/3bef7482ae58f0cd1e858d28516bbe6e62c67d13#diff-eeb9e64780aabe9b2d7d6de3f0522447R159
Do you mind making the PR @soullivaneuh and modifying the NEXT_MAJOR
comment which lead to the mistake ?
Sure! I think so too, in fact @core23 pointed me that out and I re-added them back in https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/945/commits/cdaae029279d237330ea730b95afbdafb93f86aa, but I missed the one in DatagridBuilder.php.
To me, they should been added.
I let the PR work for anybody who wants to, I do not have enough time to allow sorry.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Environment
Sonata packages
Symfony packages
PHP version
Subject
After a
composer update
, moving from admin-bundlev3.51.0
tov3.66.0
, I have a crash doing a global search:Steps to reproduce
v3.66.0
ModelAutocompleteType
(see implement example)Expected results
Working as before.
Actual results