Entity.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Symfony\Tests\Component\Validator\Fixtures;
  3. require_once __DIR__.'/EntityParent.php';
  4. require_once __DIR__.'/EntityInterface.php';
  5. /**
  6. * @validation:NotNull
  7. * @Symfony\Tests\Component\Validator\Fixtures\ConstraintA
  8. * @validation:Min(3)
  9. * @validation:Choice({"A", "B"})
  10. * @validation:Set({
  11. * @validation:All({@validation:NotNull, @validation:Min(3)}),
  12. * @validation:All(constraints={@validation:NotNull, @validation:Min(3)})
  13. * })
  14. * @validation:Collection(fields={
  15. * "foo" = {@validation:NotNull, @validation:Min(3)},
  16. * "bar" = @validation:Min(5)
  17. * })
  18. * @validation:GroupSequence({"Foo", "Entity"})
  19. */
  20. class Entity extends EntityParent implements EntityInterface
  21. {
  22. /**
  23. * @validation:Choice(choices={"A", "B"}, message="Must be one of %choices%")
  24. */
  25. protected $firstName;
  26. protected $lastName;
  27. public $reference;
  28. private $internal;
  29. public function __construct($internal = null)
  30. {
  31. $this->internal = $internal;
  32. }
  33. public function getInternal()
  34. {
  35. return $this->internal . ' from getter';
  36. }
  37. /**
  38. * @validation:NotNull
  39. */
  40. public function getLastName()
  41. {
  42. return $this->lastName;
  43. }
  44. }