Completed
Push — master ( 205ee7...22ecc2 )
by Marco
17s
created

DDC5934BaseContract::loadMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 1
1
<?php
2
3
namespace Doctrine\Tests\Models\DDC5934;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping\Column;
7
use Doctrine\ORM\Mapping\ClassMetadata;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\ManyToMany;
12
13
/**
14
 * @Entity
15
 */
16
class DDC5934BaseContract
17
{
18
    /**
19
     * @Id()
20
     * @Column(name="id", type="integer")
21
     * @GeneratedValue()
22
     */
23
    public $id;
24
25
    /**
26
     * @var ArrayCollection
27
     *
28
     * @ManyToMany(targetEntity="DDC5934Member", fetch="LAZY", inversedBy="contracts")
29
     */
30
    public $members;
31
32
    public function __construct()
33
    {
34
        $this->members = new ArrayCollection();
35
    }
36
37
    public static function loadMetadata(ClassMetadata $metadata)
38
    {
39
        $metadata->mapField([
40
            'id'         => true,
41
            'fieldName'  => 'id',
42
            'type'       => 'integer',
43
            'columnName' => 'id',
44
        ]);
45
46
        $metadata->mapManyToMany([
47
            'fieldName'    => 'members',
48
            'targetEntity' => 'DDC5934Member',
49
        ]);
50
51
        $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
52
    }
53
}
54