I want to add a constraint with annotation in Symfony for a date falls within the range, but this range can not be specified explicitly with min. and max. The year should be between the current year (by subtracting the current year or number) and the minimum indicated. For example, if I type a date now must be between 2010/1960, but 2010 should be obtained from the current year-10. This can be done in any way in Symfony?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Yes it is possible, you should create a custom validation constraint as explained here :
http://symfony.com/doc/current/cookbook/validation/custom_constraint.html