This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/Validator/Fixtures/Entity.php
Fabien Potencier 0fc8906feb [Validator] forced all validation annotations to be in the validation namespace to avoid collisions, removed the need for the wrapping @Validation annotation
Before:

    /**
     * @Validation({@DateTime()})
     */

After:

    /**
     * @validation:DateTime()
     */

The @validation:Validation() construct is not needed anymore (it is still supported
as this is useful when you have several annotations with the same class).

So, the above is equivalent to:

    /**
     * @validation:Validation({@validation:DateTime()})
     */
2010-10-02 15:07:00 +02:00

51 lines
1.1 KiB
PHP

<?php
namespace Symfony\Tests\Component\Validator\Fixtures;
require_once __DIR__.'/EntityParent.php';
require_once __DIR__.'/EntityInterface.php';
/**
* @validation:NotNull
* @Symfony\Tests\Component\Validator\Fixtures\ConstraintA
* @validation:Min(3)
* @validation:Choice({"A", "B"})
* @validation:Validation({
* @validation:All({@validation:NotNull, @validation:Min(3)}),
* @validation:All(constraints={@validation:NotNull, @validation:Min(3)})
* })
* @validation:Collection(fields={
* "foo" = {@validation:NotNull, @validation:Min(3)},
* "bar" = @validation:Min(5)
* })
*/
class Entity extends EntityParent implements EntityInterface
{
/**
* @validation:Choice(choices={"A", "B"}, message="Must be one of %choices%")
*/
protected $firstName;
protected $lastName;
private $internal;
public function __construct($internal = null)
{
$this->internal = $internal;
}
public function getInternal()
{
return $this->internal . ' from getter';
}
/**
* @validation:NotNull
*/
public function getLastName()
{
return $this->lastName;
}
}