Expression.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Constraints;
  11. use Symfony\Component\Validator\Constraint;
  12. /**
  13. * @Annotation
  14. * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. * @author Bernhard Schussek <bschussek@gmail.com>
  18. */
  19. class Expression extends Constraint
  20. {
  21. const EXPRESSION_FAILED_ERROR = '6b3befbc-2f01-4ddf-be21-b57898905284';
  22. protected static $errorNames = array(
  23. self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR',
  24. );
  25. public $message = 'This value is not valid.';
  26. public $expression;
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function getDefaultOption()
  31. {
  32. return 'expression';
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function getRequiredOptions()
  38. {
  39. return array('expression');
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function getTargets()
  45. {
  46. return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT);
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function validatedBy()
  52. {
  53. return 'validator.expression';
  54. }
  55. }