Passed
Push — feature/uploadable ( 7c6d25...a7ed20 )
by Daniel
11:07
created

ComponentGroup::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\Entity\Core;
15
16
use ApiPlatform\Core\Annotation\ApiProperty;
17
use ApiPlatform\Core\Annotation\ApiResource;
18
use Doctrine\Common\Collections\ArrayCollection;
19
use Doctrine\Common\Collections\Collection;
20
use Silverback\ApiComponentsBundle\Annotation as Silverback;
21
use Silverback\ApiComponentsBundle\Entity\Utility\IdTrait;
22
use Silverback\ApiComponentsBundle\Entity\Utility\TimestampedTrait;
23
24
/**
25
 * @author Daniel West <[email protected]>
26
 *
27
 * @Silverback\Timestamped
28
 * @ApiResource
29
 */
30
class ComponentGroup
31
{
32
    use IdTrait;
33
    use TimestampedTrait;
34
35
    public string $reference;
36
37
    /**
38
     * @var Collection|Layout[]
39
     */
40
    public $layouts;
41
42
    /**
43
     * @var Collection|PageTemplate[]
44
     */
45
    public Collection $pageTemplates;
46
47
    /**
48
     * @ApiProperty(writable=false)
49
     *
50
     * @var Collection|AbstractComponent[]
51
     */
52
    public Collection $components;
53
54
    /**
55
     * @var Collection|ComponentLocation[]
56
     */
57
    public Collection $componentLocations;
58
59
    public function __construct()
60
    {
61
        $this->setId();
62
        $this->componentLocations = new ArrayCollection();
63
    }
64
}
65