Completed
Push — master ( 3d822c...064d2b )
by Valentyn
32:01
created

UserInterestedMovie::getMovie()   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
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Users\Entity;
6
7
use App\Movies\Entity\Movie;
8
use Doctrine\ORM\Mapping as ORM;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * @ORM\Entity(repositoryClass="App\Users\Repository\InterestedMovieRepository")
13
 * @ORM\Table(name="users_interested_movies",
14
 *     uniqueConstraints={
15
 *      @ORM\UniqueConstraint(name="idx_UserInterestedMovie_user_id_movie_id", columns={"user_id", "movie_id"})
16
 *     })
17
 */
18
class UserInterestedMovie
19
{
20
    /**
21
     * @ORM\Id()
22
     * @ORM\GeneratedValue()
23
     * @ORM\Column(type="integer")
24
     * @Groups({"list"})
25
     */
26
    private $id;
27
28
    /**
29
     * @ORM\ManyToOne(targetEntity="App\Users\Entity\User")
30
     * @ORM\JoinColumn(nullable=false)
31
     */
32
    private $user;
33
34
    /**
35
     * @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie")
36
     * @ORM\JoinColumn(nullable=false)
37
     */
38
    protected $movie;
39
40
    /**
41
     * UserInterestedMovie constructor.
42
     *
43
     * @param User                    $user
44
     * @param Movie                   $movie
45
     *
46
     * @throws \Exception
47
     */
48 1
    public function __construct(User $user, Movie $movie)
49
    {
50 1
        $this->user = $user;
51 1
        $this->movie = $movie;
52 1
    }
53
54 1
    public function getId(): ?int
55
    {
56 1
        return $this->id;
57
    }
58
59
    public function getUser(): User
60
    {
61
        return $this->user;
62
    }
63
64
    public function getMovie(): Movie
65
    {
66
        return $this->movie;
67
    }
68
}
69