|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Victoire\Bundle\BlogBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
6
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
7
|
|
|
use JMS\Serializer\Annotation as Serializer; |
|
8
|
|
|
use Victoire\Bundle\CoreBundle\Annotations as VIC; |
|
9
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
10
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translation; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Victoire ViewTranslation |
|
14
|
|
|
* |
|
15
|
|
|
* @ORM\Entity() |
|
16
|
|
|
* @ORM\Table(name="vic_article_translations") |
|
17
|
|
|
*/ |
|
18
|
|
View Code Duplication |
class ArticleTranslation |
|
|
|
|
|
|
19
|
|
|
{ |
|
20
|
|
|
use Translation; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var string |
|
24
|
|
|
* |
|
25
|
|
|
* @Assert\NotBlank() |
|
26
|
|
|
* @ORM\Column(name="name", type="string", length=255) |
|
27
|
|
|
* @Serializer\Groups({"search"}) |
|
28
|
|
|
* @VIC\BusinessProperty({"textable", "businessParameter", "seoable"}) |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $name; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
* |
|
35
|
|
|
* @Gedmo\Slug(handlers={ |
|
36
|
|
|
* @Gedmo\SlugHandler(class="Victoire\Bundle\BusinessEntityBundle\Handler\TwigSlugHandler" |
|
37
|
|
|
* )},fields={"name"}, updatable=false, unique=false) |
|
38
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
|
39
|
|
|
* @VIC\BusinessProperty("businessParameter") |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $slug; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var string |
|
45
|
|
|
* |
|
46
|
|
|
* @ORM\Column(name="description", type="text", nullable=true) |
|
47
|
|
|
* @VIC\BusinessProperty({"textable", "seoable"}) |
|
48
|
|
|
*/ |
|
49
|
|
|
private $description; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Get name. |
|
53
|
|
|
* |
|
54
|
|
|
* @return string |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getName() |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->name; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Set name. |
|
63
|
|
|
* |
|
64
|
|
|
* @param string $name |
|
65
|
|
|
* |
|
66
|
|
|
* @return View |
|
67
|
|
|
*/ |
|
68
|
|
|
public function setName($name) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->name = $name; |
|
71
|
|
|
|
|
72
|
|
|
return $this; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Set slug. |
|
77
|
|
|
* |
|
78
|
|
|
* @param string $slug |
|
79
|
|
|
* |
|
80
|
|
|
* @return View |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setSlug($slug) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->slug = $slug; |
|
85
|
|
|
|
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Get slug. |
|
91
|
|
|
* |
|
92
|
|
|
* @return string |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getSlug() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->slug; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Get description. |
|
101
|
|
|
* |
|
102
|
|
|
* @return string |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getDescription() |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->description; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Set category. |
|
111
|
|
|
* |
|
112
|
|
|
* @param string $category |
|
|
|
|
|
|
113
|
|
|
* |
|
114
|
|
|
* @return Article |
|
115
|
|
|
*/ |
|
116
|
|
|
public function setDescription($description) |
|
117
|
|
|
{ |
|
118
|
|
|
$this->description = $description; |
|
119
|
|
|
|
|
120
|
|
|
return $this; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
} |
|
124
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.