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