Entity.php 1.2 KB

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