Entity.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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:Validation({
  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. */
  19. class Entity extends EntityParent implements EntityInterface
  20. {
  21. /**
  22. * @validation:Choice(choices={"A", "B"}, message="Must be one of %choices%")
  23. */
  24. protected $firstName;
  25. protected $lastName;
  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. * @validation:NotNull
  37. */
  38. public function getLastName()
  39. {
  40. return $this->lastName;
  41. }
  42. }