Completed
Pull Request — master (#5938)
by Maximilian
16:49 queued 08:43
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 as ORM;
7
8
/**
9
 * @ORM\MappedSuperclass()
10
 */
11
class DDC5934BaseContract
12
{
13
    /**
14
     * @ORM\Id()
15
     * @ORM\Column(name="id", type="integer")
16
     * @ORM\GeneratedValue()
17
     */
18
    public $id;
19
20
    /**
21
     * @var ArrayCollection
22
     *
23
     * @ORM\OneToMany(targetEntity="DDC5934Member", fetch="LAZY", mappedBy="contract")
24
     */
25
    public $members;
26
27
    public function __construct()
28
    {
29
        $this->members = new ArrayCollection();
30
    }
31
32
    public static function loadMetadata($metadata)
33
    {
34
        $metadata->mapField([
35
            'id'         => true,
36
            'fieldName'  => 'id',
37
            'type'       => 'integer',
38
            'columnName' => 'id',
39
        ]);
40
41
        $metadata->mapManyToMany([
42
            'fieldName'    => 'members',
43
            'targetEntity' => 'DDC5934Member',
44
        ]);
45
46
        $metadata->setIdGeneratorType(ORM\ClassMetadata::GENERATOR_TYPE_AUTO);
47
    }
48
}
49