Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
11 / 11 |
CRAP | |
100.00% |
1 / 1 |
| Media | |
100.00% |
11 / 11 |
|
100.00% |
11 / 11 |
11 | |
100.00% |
1 / 1 |
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTitle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTitle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getAlbum | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAlbum | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Entity; |
| 4 | |
| 5 | use App\Repository\MediaRepository; |
| 6 | use Doctrine\ORM\Mapping as ORM; |
| 7 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
| 8 | use Symfony\Component\Validator\Constraints as Assert; |
| 9 | |
| 10 | #[ORM\Entity(repositoryClass: MediaRepository::class)] |
| 11 | class Media |
| 12 | { |
| 13 | #[ORM\Id] |
| 14 | #[ORM\GeneratedValue] |
| 15 | #[ORM\Column] |
| 16 | private ?int $id = null; |
| 17 | |
| 18 | #[ORM\ManyToOne(targetEntity: User::class, inversedBy: "medias", fetch: "EAGER")] |
| 19 | private ?User $user = null; |
| 20 | |
| 21 | #[ORM\ManyToOne(targetEntity: Album::class, fetch: "EAGER")] |
| 22 | private ?Album $album = null; |
| 23 | |
| 24 | #[ORM\Column] |
| 25 | private string $path; |
| 26 | |
| 27 | #[ORM\Column] |
| 28 | private string $title; |
| 29 | |
| 30 | #[Assert\File( |
| 31 | maxSize: '2M', |
| 32 | mimeTypes: ['image/jpeg', 'image/png', 'image/webp'], |
| 33 | )] |
| 34 | private ?UploadedFile $file = null; |
| 35 | |
| 36 | public function getId(): ?int |
| 37 | { |
| 38 | return $this->id; |
| 39 | } |
| 40 | |
| 41 | public function getUser(): ?User |
| 42 | { |
| 43 | return $this->user; |
| 44 | } |
| 45 | |
| 46 | public function setUser(?User $user): void |
| 47 | { |
| 48 | $this->user = $user; |
| 49 | } |
| 50 | |
| 51 | public function getPath(): string |
| 52 | { |
| 53 | return $this->path; |
| 54 | } |
| 55 | |
| 56 | public function setPath(string $path): void |
| 57 | { |
| 58 | $this->path = $path; |
| 59 | } |
| 60 | |
| 61 | public function getTitle(): string |
| 62 | { |
| 63 | return $this->title; |
| 64 | } |
| 65 | |
| 66 | public function setTitle(string $title): void |
| 67 | { |
| 68 | $this->title = $title; |
| 69 | } |
| 70 | |
| 71 | public function getFile(): ?UploadedFile |
| 72 | { |
| 73 | return $this->file; |
| 74 | } |
| 75 | |
| 76 | public function setFile(?UploadedFile $file): void |
| 77 | { |
| 78 | $this->file = $file; |
| 79 | } |
| 80 | |
| 81 | public function getAlbum(): ?Album |
| 82 | { |
| 83 | return $this->album; |
| 84 | } |
| 85 | |
| 86 | public function setAlbum(?Album $album): void |
| 87 | { |
| 88 | $this->album = $album; |
| 89 | } |
| 90 | } |