Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Moving Collection Count Check to isValid Step. #97

@ghost

Description

Would it make sense to remove the thrown DomainException when calling $form->setData() (here, here, and here) and add a validator that will check for this? Returning an accurate error message becomes very ugly when using multiple collections on one form.

From:

try{
    $form->setData($data);

    if($form->isValid()){
        ...
    }else{
        ...
    }
}catch(DomainException $e){
    //If I had multiple collections, I would need to check $data to see which one caused the exception.
    $errors = [
        'myCollection' => [
             'count' => 'Some error message'
        ]
    ];
}

To:

$form->setData($data);

if($form->isValid()){
    ...
}else{
    ...
}

Activity

weierophinney

weierophinney commented on Jul 5, 2016

@weierophinney
Member

Honestly, no idea. 😄

Can you provide a pull request that demonstrates how you'd like to consume this from a userland perspective? That may help us better understand where it's falling short, and potentially other directions for addressing it.

Thanks!

weierophinney

weierophinney commented on Dec 31, 2019

@weierophinney
Member

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at laminas/laminas-form#29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @weierophinney@froschdesign

        Issue actions

          Moving Collection Count Check to isValid Step. · Issue #97 · zendframework/zend-form