Closed pixelsucht closed 4 years ago
Hello @rechengehirn did you solve your issue ?
@lalop I fixed it with a callback. Like so:
->add('ingredient', 'sonata_type_model_autocomplete', [
'property' => 'translations.name',
'allow_extra_fields' => true,
'multiple' => false,
'required' => false,
'callback' => function ($admin, $property, $value) {
$datagrid = $admin->getDatagrid();
$queryBuilder = $datagrid->getQuery();
$queryBuilder
->andWhere('s_translations.name LIKE :input')
->setParameter('input', $value.'%');
}
])
This bug report seems to be incomplete. Are you using a2lix/TranslationFormBundle?
@pulzarraider Yes, I'm using a2lix/TranslationFormBundle
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Environment
Sonata packages
Symfony packages
PHP version
Subject
sonata_type_model_autocomplete Doctrine Query without "where" when using KNP Translatable
Steps to reproduce
class
RecipeAdmin
class
TagAdmin
Entity
Tag
Entity
TagTranslation
Expected results
Doctrine Query with where claus
Actual results
Doctrine is not adding where clause: