Is it possible to validate a property of a model class dependent on another property of the same class?
For example, I have this class:
class Conference
{
/** $startDate datetime */
protected $startDate;
/** $endDate datetime */
protected $endDate;
}
and I want that Symfony 2.0 validates, that $startDate has to be after $endDate.
Is this possible by annotations or do I have to do this manually?
Yes with the callback validator: http://symfony.com/doc/current/reference/constraints/Callback.html
On symfony 2.0:
On symfony master version:
Here I choose to show the error message on the startDate field.