EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Validation collection field doesn't work

Open piterssson opened this issue 11 months ago • 1 comments

Description

I've added validation for fields inside collectionField (and option useEntryCrudForm) and it doesn't work

To Reproduce

    public function configureFields(string $pageName): iterable
    {
        return [
            AssociationField::new('rangeEntity', 'range')
                ->setColumns('col-md-10 col-xxl-10')
                ->setRequired(true),
            NumberField::new('price', 'price')
                ->setColumns('col-md-10 col-xxl-10'),
            NumberField::new('margin', 'margin')
                ->setColumns('col-md-10 col-xxl-10')
                ->setRequired(true),

        ];
    }
    public function configureFields(string $pageName): iterable
    {
        return [
            CollectionField::new('priceItems', 'price_range')
                ->setColumns('col-md-8 col-xxl-8')
                ->onlyOnForms()
                ->useEntryCrudForm(PriceItemCrudController::class) 
        ];

When I try save ... error appear:

Zrzut ekranu z 2024-02-28 17-34-20

piterssson avatar Feb 28 '24 16:02 piterssson

Same here. I have a OneToMany relation and I would like my collection items to be rendered by using the corresponding crud controller. But when submitting the page of the "One" side, my validation constraints of my "Many" entity on entity properties are completely ignored

ServerExe avatar Apr 08 '24 13:04 ServerExe