Completed
Push — master ( 1c7355...3d9909 )
by Valentyn
02:56
created

MovieRecommendation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Movies\Entity;
6
7
use App\Users\Entity\User;
8
use Doctrine\ORM\Mapping as ORM;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * @ORM\Entity(repositoryClass="App\Movies\Repository\MovieRecommendationRepository")
13
 * @ORM\Table(name="movies_recommendations",
14
 *     uniqueConstraints={
15
 *      @ORM\UniqueConstraint(name="MovieRecommendation_original_movie_recommended_movie_user", columns={"original_movie_id", "recommended_movie_id", "user_id"})
16
 *     })
17
 */
18
class MovieRecommendation
19
{
20
    /**
21
     * @ORM\Id()
22
     * @ORM\GeneratedValue()
23
     * @ORM\Column(type="integer")
24
     * @Groups({"list", "view"})
25
     */
26
    private $id;
27
28
    /**
29
     * @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie")
30
     * @ORM\JoinColumn(nullable=false)
31
     */
32
    private $originalMovie;
33
34
    /**
35
     * @ORM\ManyToOne(targetEntity="App\Movies\Entity\Movie")
36
     * @ORM\JoinColumn(nullable=false)
37
     */
38
    private $recommendedMovie;
39
40
    /**
41
     * @ORM\ManyToOne(targetEntity="App\Users\Entity\User")
42
     * @ORM\JoinColumn(nullable=false)
43
     */
44
    private $user;
45
46
    /**
47
     * MovieRecommendation constructor.
48
     *
49
     * @param User $user
50
     * @param Movie $originalMovie
51
     * @param Movie $recommendedMovie
52
     */
53 1
    public function __construct(User $user, Movie $originalMovie, Movie $recommendedMovie)
54
    {
55 1
        $this->user = $user;
56 1
        $this->originalMovie = $originalMovie;
57 1
        $this->recommendedMovie = $recommendedMovie;
58 1
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getId(): int
64
    {
65
        return $this->id;
66
    }
67
68
    /**
69
     * @return User
70
     */
71
    public function getUser(): User
72
    {
73
        return $this->user;
74
    }
75
76
    /**
77
     * @return Movie
78
     */
79
    public function getOriginalMovie(): Movie
80
    {
81
        return $this->originalMovie;
82
    }
83
84
    /**
85
     * @return Movie
86
     */
87
    public function getRecommendedMovie(): Movie
88
    {
89
        return $this->recommendedMovie;
90
    }
91
}
92