Completed
Push — master ( 0b4911...4851fa )
by Valentyn
04:19 queued 11s
created

GuestWatchedMovie   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 54.55%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 47
ccs 6
cts 11
cp 0.5455
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setGuestSession() 0 4 1
A getGuestSession() 0 4 1
A getId() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Guests\Entity;
6
7
use App\Movies\Entity\Movie;
8
use App\Movies\Entity\WatchedMovie;
9
use Doctrine\ORM\Mapping as ORM;
10
use Symfony\Component\Serializer\Annotation\Groups;
11
12
/**
13
 * @ORM\Entity(repositoryClass="App\Guests\Repository\WatchedMovieRepository")
14
 * @ORM\Table(name="guests_watched_movies",
15
 *     uniqueConstraints={
16
 *      @ORM\UniqueConstraint(name="idx_GuestWatchedMovie_guest_session_id_movie_id", columns={"guest_session_id", "movie_id"})
17
 *     })
18
 */
19
class GuestWatchedMovie extends WatchedMovie
20
{
21
    /**
22
     * @ORM\Id()
23
     * @ORM\GeneratedValue()
24
     * @ORM\Column(type="integer")
25
     * @Groups({"list"})
26
     */
27
    private $id;
28
29
    /**
30
     * @ORM\ManyToOne(targetEntity="App\Guests\Entity\GuestSession")
31
     * @ORM\JoinColumn(nullable=false)
32
     */
33
    private $guestSession;
34
35
    /**
36
     * UserWatchedMovies constructor.
37
     *
38
     * @param GuestSession            $guestSession
39
     * @param Movie                   $movie
40
     * @param float|null              $vote
41
     * @param \DateTimeInterface|null $watchedAt
42
     *
43
     * @throws \Exception
44
     */
45 3
    public function __construct(GuestSession $guestSession, Movie $movie, ?float $vote, ?\DateTimeInterface $watchedAt)
46
    {
47 3
        $this->guestSession = $guestSession;
48 3
        parent::__construct($movie, $vote, $watchedAt);
49 3
    }
50
51
    public function setGuestSession(GuestSession $guestSession): void
52
    {
53
        $this->guestSession = $guestSession;
54
    }
55
56 1
    public function getGuestSession(): ?GuestSession
57
    {
58 1
        return $this->guestSession;
59
    }
60
61
    public function getId(): int
62
    {
63
        return (int) $this->id;
64
    }
65
}
66