I want to validate my parameter with my own validator, but it's not called, but why?
/**
* action create
*
* @param \Company\MyExt\Domain\Model\ProtokollKalender $newProtokollKalender
* @validate $newProtokollKalender \Company\MyExt\Validation\Validators\KalenderValidator
* @return void
*/
public function createAction(\Company\MyExt\Domain\Model\ProtokollKalender $newProtokollKalender)
....
The annotation in PHPdoc to trigger the validator seems to be correect ( see documentation ).
/**
* @param Model $property
* @validate $property \Vendor\Extension\Validation\Validator\CustomValidator
*/
public function someAction(Model $property) {}
Besides that, there is a shorter way to reference to validators in the sub-namespace ~\\Validation\\Validator
.
/**
* @param Model $property
* @validate $property Vendor.Extension:Custom
*/
public function someAction(Model $property) {}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.