Passed
Push — 2.6 ( 90d19b...c2f698 )
by Luís
09:48
created

ChildClass::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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