sort and filter menuitems in aliasof select
This commit is contained in:
parent
3a144c5db3
commit
7b95ed44ee
1 changed files with 26 additions and 32 deletions
|
@ -12,11 +12,8 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function assert;
|
||||
|
||||
final class MenuItemType extends AbstractType
|
||||
{
|
||||
#[Override]
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$item = $options['data'];
|
||||
|
@ -38,9 +35,7 @@ final class MenuItemType extends AbstractType
|
|||
->andWhere('m.deletedAt IS NULL')
|
||||
->andWhere('m.id != :id')
|
||||
->andWhere(
|
||||
$qb->expr()
|
||||
->notIn(
|
||||
'm.id',
|
||||
$qb->expr()->notIn('m.id',
|
||||
$repository->createQueryBuilder('m2')
|
||||
->select('m2.id')
|
||||
->where('m2.aliasOf != m.id') // Reference m.id in the inner query
|
||||
|
@ -56,7 +51,6 @@ final class MenuItemType extends AbstractType
|
|||
},
|
||||
]);
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue