Completed
Pull Request — master (#5938)
by Maximilian
117:35 queued 53:02
created

DDC5934BaseContract   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A loadMetadata() 0 16 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