Passed
Pull Request — master (#211)
by Kevin
02:57
created

ProductComment::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Entity\Cascade;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @ORM\Entity
9
 * @ORM\Table(name="product_comment_cascade")
10
 */
11
class ProductComment
12
{
13
    /**
14
     * @ORM\Id
15
     * @ORM\GeneratedValue
16
     * @ORM\Column(type="integer")
17
     */
18
    private $id;
19
20
    /**
21
     * @ORM\Column(type="string", length=255)
22
     */
23
    private $body;
24
25
    /**
26
     * @ORM\ManyToOne(targetEntity=Product::class, inversedBy="comments")
27
     * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
28
     */
29
    private $product;
30
31
    public function __construct(Product $product, string $body)
32
    {
33
        $this->product = $product;
34
        $this->body = $body;
35
    }
36
37
    public function getId(): ?int
38
    {
39
        return $this->id;
40
    }
41
42
    public function getProduct(): Product
43
    {
44
        return $this->product;
45
    }
46
47
    public function getBody(): string
48
    {
49
        return $this->body;
50
    }
51
}
52