Bug #4168

Rules added with @validate will replace existing validation rules

Added by Robert Lemke about 10 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
MVC
Start date:
2009-08-06
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

Description

A @validate annotation placed in an action method's comment should add new validation rules to the existing base validation of an argument.
However, it currently replaces existing rules.

The following code currently leads to disabling validation for the $blog argument which should not be possible by a @validate annotation:

    /**
     * Edits an existing blog
     *
     * @param \F3\Blog\Domain\Model\Blog $blog The blog to be edited. This might also be a clone of the original blog already containing modifications if the edit form has been submitted, contained errors and therefore ended up in this action again.
     * @return string Form for editing the existing blog
     * @validate $blog Raw
     */
    public function editAction(\F3\Blog\Domain\Model\Blog $blog) {
        $this->view->assign('blog', $blog);
    }

Associated revisions

Revision 10ec9ad8 (diff)
Added by Robert Lemke about 10 years ago

[+FEATURE] FLOW3 (MVC): It is now possible to disable validation temporarily for single controller arguments. This is necessary in situations where a knowingly incomplete / invalid argument needs to be passed to an action, for example an edit action. Validation can be disabled either by calling the disableValidation() method on the argument object or by adding a @dontvalidate $argumentName annotation to an action method. Resolves #4166
[+TASK] FLOW3 (Documentation): Documented the new @dontvalidate annotation.
[+FEATURE] FLOW3 (Package): The package manager's command line controller now returns a friendly error message on trying to activate or deactivate an already active or inactive package. Earlier it just threw an unpolished exception.
[+FEATURE] FLOW3 (Persistence): Implemented an update() method for the base repository which allows for conveniently updating existing objects. update() only expects one argument which must be a clone of the object to replace, already containing the modifications. The object passed to update() must internally contain the same uuid like the object to be updated (ie. replaced). In fact this new update() method is basically a more convenient way to call replace(). Resolves #4167
[+BUGFIX] FLOW3 (MVC): A @validate annotation placed in an action method's comment replaced existing rules instead of adding them to a common conjunction validator. By this it was possible to override any validation rule with a simple @validate $foo Raw annotation. Fixes #4168

History

#1 Updated by Robert Lemke about 10 years ago

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

Applied in changeset r2989.

Also available in: Atom PDF