Feature #6993

Support declaration of additional validation rules by object accessor syntax

Added by Robert Lemke over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Validation
Start date:
2010-03-24
Due date:
% Done:

100%

Estimated time:
7.00 h
PHP Version:
Has patch:
Complexity:

Description

It is possible to declare additional validation rules in the doc comment of an action methods:

    /**
     * Creates a new participant + account.
     *
     * @param \F3\Conference\Domain\Model\Participant $newParticipant
     * @param string $password
     * @return void
     * @validate $password StringLength(minimum = 5)
     */
    public function createAction(\F3\Conference\Domain\Model\Participant $newParticipant, $password) {
    ...

However, it's not possible to declare a validation rule which refers to a sub object of one of the method arguments. In the above example it would be nice to declare that the first name of the person name of the new participant must not be empty (= is required). This could be achieved by supporting the object accessor syntax known from Fluid templates:

    /**
     * Creates a new participant + account.
     *
     * @param \F3\Conference\Domain\Model\Participant $newParticipant
     * @param string $password
     * @return void
     * @validate $newParticipant.name.firstName NotEmpty
     * @validate $password StringLength(minimum = 5)
     */
    public function createAction(\F3\Conference\Domain\Model\Participant $newParticipant, $password) {
    ...

In its first implementation, this new syntax will only apply to @validate annotations in action methods.

Associated revisions

Revision 801396ee (diff)
Added by Robert Lemke over 9 years ago

[+FEATURE] FLOW3 (Validation): The @validate annotations in action methods now support an object accessor syntax ($argument.subobject.subsubobject) for declaring additional validation rules referring to a property of a nested object. Resolves #6993
[~TASK] FLOW3 (Validation): Brushed up and unified the messages of most validators.
[~TASK] FLOW3 (Error): The var_dump method now also filters PHPUnit Invocation Mokers.

Revision 2d005788 (diff)
Added by Robert Lemke over 9 years ago

[+FEATURE] FLOW3 (Validation): The @validate annotations in action methods now support an object accessor syntax ($argument.subobject.subsubobject) for declaring additional validation rules referring to a property of a nested object. Resolves #6993
[~TASK] FLOW3 (Validation): Brushed up and unified the messages of most validators.
[~TASK] FLOW3 (Error): The var_dump method now also filters PHPUnit Invocation Mokers.

History

#1 Updated by Robert Lemke over 9 years ago

  • Status changed from New to Accepted
  • % Done changed from 0 to 10
  • Estimated time set to 4.00 h

#2 Updated by Robert Lemke over 9 years ago

  • Estimated time changed from 4.00 h to 7.00 h

#3 Updated by Robert Lemke over 9 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 10 to 100

Applied in changeset r4013.

Also available in: Atom PDF