-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
attributes.txt
59 lines (53 loc) · 1.31 KB
/
attributes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace Entity;
#[MyAttribute]
#[\MyExample\MyAttribute]
#[MyAttribute(1234)]
#[MyAttribute(value: 1234)]
#[ASSERT(value: 1234)]
#[HTMLAttribute(tag: "h1")]
#[MyAttribute(MyAttribute::VALUE)]
#[MyAttribute(array("key" => "value"))]
#[MyAttribute(100 + 200)]
class Foo {}
#[MyAttribute(1234), MyAttribute(5678)]
class Bar
{
#[Assert\IsTrue(message: 'The password cannot match your given name')]
public function isPasswordSafe()
{
}
#[Assert\AtLeastOneOf([
new Assert\Count(min: 2),
new Assert\All(
new Assert\GreaterThanOrEqual(7)
),
])]
public $stuff;
}
class Book
{
#[Assert\Choice(
choices: ['blue', 'green'],
message: 'Choose a valid color.',
)]
private $color;
#[Assert\Choice(['Hardcover', 'Paperback'])]
private $format;
#[
Assert\Collection(
fields: [
'authorEmail' => new Assert\Email,
'shortDesc' => [
/*something*/
new Assert\NotBlank,
new Assert\Length(
max: 200,
maxMessage: 'Your short desc is too long'
)
],
],
allowMissingFields: true,
)
]
protected $additionalData;
}