| @@ 17-113 (lines=97) @@ | ||
| 14 | * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="name_idx", columns={"name"})}) |
|
| 15 | * @ORM\Entity |
|
| 16 | */ |
|
| 17 | class Artist |
|
| 18 | { |
|
| 19 | use TimestampableEntity; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @var integer |
|
| 23 | * |
|
| 24 | * @ORM\Column(name="id", type="integer") |
|
| 25 | * @ORM\Id |
|
| 26 | * @ORM\GeneratedValue(strategy="AUTO") |
|
| 27 | */ |
|
| 28 | private $id; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @var string |
|
| 32 | * |
|
| 33 | * @ORM\Column(name="name", type="string", length=200, nullable=false) |
|
| 34 | * @Groups({"artist-read", "media-read"}) |
|
| 35 | */ |
|
| 36 | private $name; |
|
| 37 | /** |
|
| 38 | * @ORM\ManyToMany(targetEntity="\AudioCoreEntity\Entity\Media",mappedBy="artists") |
|
| 39 | * @Groups({"artist-read"}) |
|
| 40 | **/ |
|
| 41 | private $medias; |
|
| 42 | ||
| 43 | /** |
|
| 44 | * @var string |
|
| 45 | * @Gedmo\Slug(fields={"name"}, unique=true) |
|
| 46 | * @ORM\Column(type="string", length=128, unique=true) |
|
| 47 | */ |
|
| 48 | protected $slug; |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Artist constructor. |
|
| 52 | * @param null $name |
|
| 53 | */ |
|
| 54 | public function __construct($name = null) |
|
| 55 | { |
|
| 56 | $this->setName($name); |
|
| 57 | $this->medias = new ArrayCollection(); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Get id |
|
| 62 | * |
|
| 63 | * @return integer |
|
| 64 | */ |
|
| 65 | public function getId() |
|
| 66 | { |
|
| 67 | return $this->id; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @return string |
|
| 72 | */ |
|
| 73 | public function getName() |
|
| 74 | { |
|
| 75 | return $this->name; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * @param string $name |
|
| 80 | * @return $this |
|
| 81 | */ |
|
| 82 | public function setName($name) |
|
| 83 | { |
|
| 84 | $this->name = $name; |
|
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * @return mixed |
|
| 90 | */ |
|
| 91 | public function getMedias() |
|
| 92 | { |
|
| 93 | return $this->medias; |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * @param mixed $medias |
|
| 98 | * @return Artist |
|
| 99 | */ |
|
| 100 | public function setMedias($medias) |
|
| 101 | { |
|
| 102 | $this->medias = $medias; |
|
| 103 | return $this; |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * @return string |
|
| 108 | */ |
|
| 109 | public function getSlug() |
|
| 110 | { |
|
| 111 | return $this->slug; |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| @@ 18-114 (lines=97) @@ | ||
| 15 | * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="name_idx", columns={"name"})}, options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}) |
|
| 16 | * @ORM\Entity |
|
| 17 | */ |
|
| 18 | class Genre |
|
| 19 | { |
|
| 20 | use TimestampableEntity; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var integer |
|
| 24 | * |
|
| 25 | * @ORM\Column(name="id", type="integer") |
|
| 26 | * @ORM\Id |
|
| 27 | * @ORM\GeneratedValue(strategy="AUTO") |
|
| 28 | */ |
|
| 29 | private $id; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | * |
|
| 34 | * @ORM\Column(name="name", type="string", length=50, nullable=false) |
|
| 35 | * @Assert\NotBlank() |
|
| 36 | * @Groups({"genre-read", "media-read"}) |
|
| 37 | */ |
|
| 38 | private $name; |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @ORM\ManyToMany(targetEntity="\AudioCoreEntity\Entity\Media",mappedBy="genres") |
|
| 42 | * @Groups({"genre-read"}) |
|
| 43 | **/ |
|
| 44 | private $medias; |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @var string |
|
| 48 | * @Gedmo\Slug(fields={"name"}, unique=true) |
|
| 49 | * @ORM\Column(type="string", length=128, unique=true) |
|
| 50 | */ |
|
| 51 | protected $slug; |
|
| 52 | ||
| 53 | public function __construct($name = null) |
|
| 54 | { |
|
| 55 | $this->setName($name); |
|
| 56 | $this->medias = new ArrayCollection(); |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Get id |
|
| 61 | * |
|
| 62 | * @return integer |
|
| 63 | */ |
|
| 64 | public function getId() |
|
| 65 | { |
|
| 66 | return $this->id; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * @return string |
|
| 71 | */ |
|
| 72 | public function getName() |
|
| 73 | { |
|
| 74 | return $this->name; |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @param string $name |
|
| 79 | * @return $this |
|
| 80 | */ |
|
| 81 | public function setName($name) |
|
| 82 | { |
|
| 83 | $this->name = $name; |
|
| 84 | ||
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * @return mixed |
|
| 90 | */ |
|
| 91 | public function getMedias() |
|
| 92 | { |
|
| 93 | return $this->medias; |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * @param mixed $medias |
|
| 98 | * @return Genre |
|
| 99 | */ |
|
| 100 | public function setMedias($medias) |
|
| 101 | { |
|
| 102 | $this->medias = $medias; |
|
| 103 | ||
| 104 | return $this; |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * @return string |
|
| 109 | */ |
|
| 110 | public function getSlug() |
|
| 111 | { |
|
| 112 | return $this->slug; |
|
| 113 | } |
|
| 114 | } |
|
| 115 | ||