Version 1
[yaffs-website] / vendor / symfony / validator / Tests / Fixtures / Entity.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Validator\Tests\Fixtures;
13
14 use Symfony\Component\Validator\Constraints as Assert;
15 use Symfony\Component\Validator\ExecutionContextInterface;
16
17 /**
18  * @Symfony\Component\Validator\Tests\Fixtures\ConstraintA
19  * @Assert\GroupSequence({"Foo", "Entity"})
20  * @Assert\Callback({"Symfony\Component\Validator\Tests\Fixtures\CallbackClass", "callback"})
21  */
22 class Entity extends EntityParent implements EntityInterfaceB
23 {
24     /**
25      * @Assert\NotNull
26      * @Assert\Range(min=3)
27      * @Assert\All({@Assert\NotNull, @Assert\Range(min=3)}),
28      * @Assert\All(constraints={@Assert\NotNull, @Assert\Range(min=3)})
29      * @Assert\Collection(fields={
30      *   "foo" = {@Assert\NotNull, @Assert\Range(min=3)},
31      *   "bar" = @Assert\Range(min=5)
32      * })
33      * @Assert\Choice(choices={"A", "B"}, message="Must be one of %choices%")
34      */
35     public $firstName;
36     protected $lastName;
37     public $reference;
38     public $reference2;
39     private $internal;
40     public $data = 'Overridden data';
41     public $initialized = false;
42
43     public function __construct($internal = null)
44     {
45         $this->internal = $internal;
46     }
47
48     public function getInternal()
49     {
50         return $this->internal.' from getter';
51     }
52
53     public function setLastName($lastName)
54     {
55         $this->lastName = $lastName;
56     }
57
58     /**
59      * @Assert\NotNull
60      */
61     public function getLastName()
62     {
63         return $this->lastName;
64     }
65
66     public function getValid()
67     {
68     }
69
70     /**
71      * @Assert\IsTrue
72      */
73     public function isValid()
74     {
75         return 'valid';
76     }
77
78     /**
79      * @Assert\IsTrue
80      */
81     public function hasPermissions()
82     {
83         return 'permissions';
84     }
85
86     public function getData()
87     {
88         return 'Overridden data';
89     }
90
91     /**
92      * @Assert\Callback(payload="foo")
93      */
94     public function validateMe(ExecutionContextInterface $context)
95     {
96     }
97
98     /**
99      * @Assert\Callback
100      */
101     public static function validateMeStatic($object, ExecutionContextInterface $context)
102     {
103     }
104 }