Completed
Push — master ( 4851fa...058e40 )
by Valentyn
04:07
created

GuestWatchedMovie::getGuestSession()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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 2
    public function __construct(GuestSession $guestSession, Movie $movie, ?float $vote, ?\DateTimeInterface $watchedAt)
46
    {
47 2
        $this->guestSession = $guestSession;
48 2
        parent::__construct($movie, $vote, $watchedAt);
49 2
    }
50
51
    public function setGuestSession(GuestSession $guestSession): void
52
    {
53
        $this->guestSession = $guestSession;
54
    }
55
56
    public function getGuestSession(): ?GuestSession
57
    {
58
        return $this->guestSession;
59
    }
60
61
    public function getId(): int
62
    {
63
        return (int) $this->id;
64
    }
65
}
66