2010-06-24 09:40:05 +01:00
|
|
|
<?php
|
|
|
|
|
2012-04-02 04:52:14 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2012-03-28 14:43:52 +01:00
|
|
|
namespace Symfony\Component\Validator\Tests\Fixtures;
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2011-05-01 13:50:28 +01:00
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
|
2010-06-24 09:40:05 +01:00
|
|
|
/**
|
2012-03-28 14:43:52 +01:00
|
|
|
* @Symfony\Component\Validator\Tests\Fixtures\ConstraintA
|
2011-05-01 13:50:28 +01:00
|
|
|
* @Assert\GroupSequence({"Foo", "Entity"})
|
2010-06-24 09:40:05 +01:00
|
|
|
*/
|
|
|
|
class Entity extends EntityParent implements EntityInterface
|
|
|
|
{
|
2010-06-24 10:24:08 +01:00
|
|
|
/**
|
2011-05-01 13:50:28 +01:00
|
|
|
* @Assert\NotNull
|
2013-01-24 09:48:29 +00:00
|
|
|
* @Assert\Range(min=3)
|
|
|
|
* @Assert\All({@Assert\NotNull, @Assert\Range(min=3)}),
|
|
|
|
* @Assert\All(constraints={@Assert\NotNull, @Assert\Range(min=3)})
|
2011-05-01 13:50:28 +01:00
|
|
|
* @Assert\Collection(fields={
|
2013-01-24 09:48:29 +00:00
|
|
|
* "foo" = {@Assert\NotNull, @Assert\Range(min=3)},
|
|
|
|
* "bar" = @Assert\Range(min=5)
|
2011-01-19 14:30:43 +00:00
|
|
|
* })
|
2011-05-01 13:50:28 +01:00
|
|
|
* @Assert\Choice(choices={"A", "B"}, message="Must be one of %choices%")
|
2010-06-24 10:24:08 +01:00
|
|
|
*/
|
|
|
|
protected $firstName;
|
|
|
|
protected $lastName;
|
2010-11-16 23:51:45 +00:00
|
|
|
public $reference;
|
2010-06-24 10:24:08 +01:00
|
|
|
private $internal;
|
2013-03-05 15:41:51 +00:00
|
|
|
public $data = 'Overridden data';
|
2010-06-24 10:24:08 +01:00
|
|
|
|
|
|
|
public function __construct($internal = null)
|
|
|
|
{
|
|
|
|
$this->internal = $internal;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getInternal()
|
|
|
|
{
|
2013-04-02 10:39:57 +01:00
|
|
|
return $this->internal.' from getter';
|
2010-06-24 10:24:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-05-01 13:50:28 +01:00
|
|
|
* @Assert\NotNull
|
2010-06-24 10:24:08 +01:00
|
|
|
*/
|
|
|
|
public function getLastName()
|
|
|
|
{
|
|
|
|
return $this->lastName;
|
|
|
|
}
|
2013-03-05 15:41:51 +00:00
|
|
|
|
|
|
|
public function getData()
|
|
|
|
{
|
|
|
|
return 'Overridden data';
|
|
|
|
}
|
2010-10-02 13:42:01 +01:00
|
|
|
}
|