1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\TrickRepository") |
12
|
|
|
* @UniqueEntity(fields="name", message="this trick already exists") |
13
|
|
|
*/ |
14
|
|
|
class Trick |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
const NUMBER_OF_DISPLAYED_TRICKS = 10; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @ORM\Id() |
21
|
|
|
* @ORM\GeneratedValue() |
22
|
|
|
* @ORM\Column(type="integer") |
23
|
|
|
*/ |
24
|
|
|
private $id; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @ORM\Column(type="string", length=255) |
28
|
|
|
* @Assert\Length( |
29
|
|
|
* min=5, |
30
|
|
|
* max=255, |
31
|
|
|
* minMessage = "Title must be at least {{ limit }} characters", |
32
|
|
|
* maxMessage = "Title can not exceed {{ limit }} characters" |
33
|
|
|
* ) |
34
|
|
|
*/ |
35
|
|
|
private $name; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @ORM\Column(type="text") |
39
|
|
|
*/ |
40
|
|
|
private $text; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @ORM\Column(type="string", length=255, unique=true) |
44
|
|
|
* @Gedmo\Slug(fields={"name"}) |
45
|
|
|
*/ |
46
|
|
|
private $slug; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @ORM\Column(type="datetime") |
50
|
|
|
* @Gedmo\Timestampable(on="create") |
51
|
|
|
*/ |
52
|
|
|
private $createdAt; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @ORM\Column(type="datetime") |
56
|
|
|
* @Gedmo\Timestampable(on="update") |
57
|
|
|
*/ |
58
|
|
|
private $editedAt; |
59
|
|
|
|
60
|
|
|
public function getId(): ?int |
61
|
|
|
{ |
62
|
|
|
return $this->id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getName(): ?string |
66
|
|
|
{ |
67
|
|
|
return $this->name; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setName(string $name): self |
71
|
|
|
{ |
72
|
|
|
$this->name = $name; |
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getText(): ?string |
78
|
|
|
{ |
79
|
|
|
return $this->text; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function setText(string $text): self |
83
|
|
|
{ |
84
|
|
|
$this->text = $text; |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getSlug(): ?string |
90
|
|
|
{ |
91
|
|
|
return $this->slug; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function setSlug(string $slug): self |
95
|
|
|
{ |
96
|
|
|
$this->slug = $slug; |
97
|
|
|
|
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getCreatedAt(): ?\DateTimeInterface |
102
|
|
|
{ |
103
|
|
|
return $this->createdAt; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function setCreatedAt(\DateTimeInterface $createdAt): self |
107
|
|
|
{ |
108
|
|
|
$this->createdAt = $createdAt; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getEditedAt(): ?\DateTimeInterface |
114
|
|
|
{ |
115
|
|
|
return $this->editedAt; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function setEditedAt(\DateTimeInterface $editedAt): self |
119
|
|
|
{ |
120
|
|
|
$this->editedAt = $editedAt; |
121
|
|
|
|
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|