1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\VideoRepository") |
9
|
|
|
*/ |
10
|
|
|
class Video extends AbstractAppEntity |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @ORM\Id() |
14
|
|
|
* @ORM\GeneratedValue() |
15
|
|
|
* @ORM\Column(type="integer") |
16
|
|
|
*/ |
17
|
|
|
private $id; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @ORM\Column(type="string", length=255) |
21
|
|
|
*/ |
22
|
|
|
private $title; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @ORM\Column(type="string", length=255) |
26
|
|
|
*/ |
27
|
|
|
private $code; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\Trick", inversedBy="videos", cascade={"persist"}) |
31
|
|
|
* @ORM\JoinColumn(onDelete="CASCADE") |
32
|
|
|
*/ |
33
|
|
|
private $trick; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\VideoType", inversedBy="video") |
37
|
|
|
* @ORM\JoinColumn(nullable=false) |
38
|
|
|
*/ |
39
|
|
|
private $videoType; |
40
|
|
|
|
41
|
|
|
public function getId(): ?int |
42
|
|
|
{ |
43
|
|
|
return $this->id; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getTitle(): ?string |
47
|
|
|
{ |
48
|
|
|
return $this->title; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function setTitle(string $title): self |
52
|
|
|
{ |
53
|
|
|
$this->title = $title; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getCode(): ?string |
59
|
|
|
{ |
60
|
|
|
return $this->code; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function setCode(string $code): self |
64
|
|
|
{ |
65
|
|
|
$this->code = $code; |
66
|
|
|
|
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getTrick(): ?Trick |
71
|
|
|
{ |
72
|
|
|
return $this->trick; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function setTrick(?Trick $trick): self |
76
|
|
|
{ |
77
|
|
|
$this->trick = $trick; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function getVideoType(): ?VideoType |
83
|
|
|
{ |
84
|
|
|
return $this->videoType; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function setVideoType(?VideoType $videoType): self |
88
|
|
|
{ |
89
|
|
|
$this->videoType = $videoType; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getVideoIntegrationCode(){ |
95
|
|
|
return str_replace("{{code}}", $this->getCode(), $this->getVideoType()->getCode()); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getVideoIntegrationImage(){ |
99
|
|
|
return str_replace("{{code}}", $this->getCode(), $this->getVideoType()->getImageCode()); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function __toString() |
103
|
|
|
{ |
104
|
|
|
return $this->getTitle(); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|