Passed
Branch dev_2x (3e8772)
by Adrian
01:42
created

OneToMany   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 10
c 0
b 0
f 0
dl 0
loc 38
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Orm\Blueprint\Relation;
5
6
use Sirius\Orm\Blueprint\Relation;
7
use Sirius\Orm\Relation\RelationConfig;
8
9
class OneToMany extends OneToOne
10
{
11
    protected $type = RelationConfig::TYPE_ONE_TO_MANY;
12
13
    protected $cascade;
14
15
    protected $aggregates = [];
16
17
    /**
18
     * @return bool
19
     */
20
    public function getCascade()
21
    {
22
        return $this->cascade;
23
    }
24
25
    /**
26
     * @param bool $cascade
27
     *
28
     * @return Relation
29
     */
30
    public function setCascade(bool $cascade)
31
    {
32
        $this->cascade = $cascade;
33
34
        return $this;
35
    }
36
37
    public function addAggregate($name, $aggregate)
38
    {
39
        $this->aggregates[$name] = $aggregate;
40
41
        return $this;
42
    }
43
44
    public function getAggregates(): array
45
    {
46
        return $this->aggregates;
47
    }
48
}
49