Entity.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Symfony\Tests\Components\Validator\Fixtures;
  3. require_once __DIR__.'/EntityParent.php';
  4. require_once __DIR__.'/EntityInterface.php';
  5. /**
  6. * @Validation({
  7. * @NotNull,
  8. * @Symfony\Tests\Components\Validator\Fixtures\ConstraintA,
  9. * @Min(3),
  10. * @Choice({"A", "B"}),
  11. * @All({@NotNull, @Min(3)}),
  12. * @All(constraints={@NotNull, @Min(3)}),
  13. * @Collection(fields={
  14. * "foo" = {@NotNull, @Min(3)},
  15. * "bar" = @Min(5)
  16. * })
  17. * })
  18. */
  19. class Entity extends EntityParent implements EntityInterface
  20. {
  21. /**
  22. * @Validation({
  23. * @Choice(choices={"A", "B"}, message="Must be one of %choices%")
  24. * })
  25. */
  26. protected $firstName;
  27. protected $lastName;
  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({
  39. * @NotNull
  40. * })
  41. */
  42. public function getLastName()
  43. {
  44. return $this->lastName;
  45. }
  46. }