I have a field with a url constraint:
/**
* @AppAssert\AccountToMarketer
*/
class Account {
/**
* @Assert\NotBlank
* @Assert\Url(
* protocols = {"https"}
* )
*/
private $url;
In the class validator "AccountToMarketerValidator" I'm doing the following to leave the rest of the validation and allow NotBlank Constraint to apply
if (null === $value->getUrl() || '' === $value->getUrl()) {
return;
}
I would like to know what is the correct syntax for checking that it's not a valid url in order to add the return statement. Something like this:
if ($value->getUrl() is not a valid URL) {
return;
}
Otherwise it would be great if there is a way to avoid those return statements. This class has only 2 fields but if I had 10 properties there must be a way to apply properties validation and return the errors and go to the class validation only when all the fields are valid.