Entity.php 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * @Min(3),
  9. * @Choice({"A", "B"}),
  10. * @All({@NotNull, @Min(3)}),
  11. * @All(constraints={@NotNull, @Min(3)}),
  12. * @Collection(fields={
  13. * "foo" = {@NotNull, @Min(3)},
  14. * "bar" = @Min(5)
  15. * })
  16. * })
  17. */
  18. class Entity extends EntityParent implements EntityInterface
  19. {
  20. /**
  21. * @Validation({
  22. * @Choice(choices={"A", "B"}, message="Must be one of %choices%")
  23. * })
  24. */
  25. protected $firstName;
  26. protected $lastName;
  27. private $internal;
  28. public function __construct($internal = null)
  29. {
  30. $this->internal = $internal;
  31. }
  32. public function getInternal()
  33. {
  34. return $this->internal . ' from getter';
  35. }
  36. /**
  37. * @Validation({
  38. * @NotNull
  39. * })
  40. */
  41. public function getLastName()
  42. {
  43. return $this->lastName;
  44. }
  45. }