[Flow] Validation triggered when trying to show object in rest controller
Christian Loock
chl at vkf-renzel.de
Wed Nov 5 13:21:40 CET 2014
Hello,
I am currently trying to implement a simple REST Controller. I defined a
route like so:
-
name:'Project REST by FileSystem Name'
uriPattern:'REST/project/{project.fileSystemName}'
defaults:
'@format':'json'
'@package':'RA.ReleaseManager'
'@controller':'projectRest'
routeParts:
project:
objectType:'RA\ReleaseManager\Domain\Model\Project'
If I now try to call the controller, the validation of the Project Model
is triggered:
Validation failed while trying to call
RA\ReleaseManager\Controller\ProjectRestController->showAction().
In the Model, I have defined Validation for a property:
/**
* The name, working copies of this project get in the file system, eg. flow_vkf_admin
*@varstring
*@Flow\Validate(type="RegularExpression", options={"regularExpression"="/^[^_]*_[^_]*_[^_]*$/"})
*@Flow\Validate(type="NotEmpty")
*/
protected$fileSystemName;
But I wonder, why this is even triggered, and why it throws an error,
since it is a model, that has been created before using the MVC stack,
running through validation just fine. Unfortunatly it doesnt give me any
further information on why the validation fails. I already looked into
the logs, with no success in finding what is going wrong here.
So this let's me with a couple of questions:
1. Why is Validation even triggered on a safe (GET) request.
2. How is it possible that the validation fails, for an object that
should be loaded from the database, according to the routing.
3. Where can I see why the validation fails in a REST controller?
More information about the Flow
mailing list