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

ProductComment   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 39
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBody() 0 3 1
A getProduct() 0 3 1
A getId() 0 3 1
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