Entity.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Symfony\Tests\Component\Validator\Fixtures;
  3. require_once __DIR__.'/EntityParent.php';
  4. require_once __DIR__.'/EntityInterface.php';
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  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. }