Passed
Push — master ( c14dbc...579f08 )
by Luís
12:22
created

ChildClass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
namespace Doctrine\Tests\Models\ManyToManyPersister;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Doctrine\ORM\Annotation as ORM;
8
9
/**
10
 * @ORM\Entity
11
 * @ORM\Table(name="manytomanypersister_child")
12
 */
13
class ChildClass
14
{
15
    /**
16
     * @ORM\Id
17
     * @ORM\Column(name="id1", type="integer")
18
     *
19
     * @var integer
20
     */
21
    public $id1;
22
23
    /**
24
     * @ORM\Id
25
     * @ORM\ManyToOne(targetEntity=OtherParentClass::class, cascade={"persist"})
26
     * @ORM\JoinColumn(name="other_parent_id", referencedColumnName="id")
27
     *
28
     * @var OtherParentClass
29
     */
30
    public $otherParent;
31
32
    /**
33
     * @ORM\ManyToMany(targetEntity=ParentClass::class, inversedBy="children")
34
     * @ORM\JoinTable(
35
     *     name="parent_child",
36
     *     joinColumns={
37
     *         @ORM\JoinColumn(name="child_id1", referencedColumnName="id1"),
38
     *         @ORM\JoinColumn(name="child_id2", referencedColumnName="other_parent_id")
39
     *     },
40
     *     inverseJoinColumns={@ORM\JoinColumn(name="parent_id", referencedColumnName="id")}
41
     * )
42
     *
43
     * @var Collection|ParentClass[]
44
     */
45
    public $parents;
46
47
    public function __construct(int $id1, OtherParentClass $otherParent)
48
    {
49
        $this->id1         = $id1;
50
        $this->otherParent = $otherParent;
51
        $this->parents     = new ArrayCollection();
52
    }
53
}
54