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\ApiFilter; |
17
|
|
|
use ApiPlatform\Core\Annotation\ApiResource; |
18
|
|
|
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
19
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
20
|
|
|
use Doctrine\Common\Collections\Collection; |
21
|
|
|
use Silverback\ApiComponentsBundle\Annotation as Silverback; |
22
|
|
|
use Silverback\ApiComponentsBundle\Entity\Utility\IdTrait; |
23
|
|
|
use Silverback\ApiComponentsBundle\Entity\Utility\TimestampedTrait; |
24
|
|
|
use Silverback\ApiComponentsBundle\Entity\Utility\UiTrait; |
25
|
|
|
use Silverback\ApiComponentsBundle\Filter\OrSearchFilter; |
26
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
27
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
28
|
|
|
use Symfony\Component\Validator\Mapping\ClassMetadata; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @author Daniel West <[email protected]> |
32
|
|
|
* |
33
|
|
|
* @Silverback\Timestamped |
34
|
|
|
* @ApiResource(mercure=true) |
35
|
|
|
* @ApiFilter(OrderFilter::class, properties={"createdAt", "reference"}, arguments={"orderParameterName"="order"}) |
36
|
|
|
* @ApiFilter(OrSearchFilter::class, properties={"reference"="ipartial", "uiComponent"="ipartial"}) |
37
|
|
|
* @UniqueEntity(fields={"reference"}, message="There is already a Layout with that reference.") |
38
|
|
|
*/ |
39
|
|
|
class Layout |
40
|
|
|
{ |
41
|
|
|
use IdTrait; |
42
|
|
|
use TimestampedTrait; |
43
|
|
|
use UiTrait; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @Assert\NotBlank(message="Please enter a reference.") |
47
|
|
|
*/ |
48
|
|
|
public string $reference; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var Collection|Page[] |
52
|
|
|
*/ |
53
|
|
|
public Collection $pages; |
54
|
|
|
|
55
|
1 |
|
public function __construct() |
56
|
|
|
{ |
57
|
1 |
|
$this->initComponentCollections(); |
58
|
1 |
|
$this->pages = new ArrayCollection(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public static function loadValidatorMetadata(ClassMetadata $metadata): void |
62
|
|
|
{ |
63
|
|
|
$metadata->addPropertyConstraint('uiComponent', new Assert\NotBlank([ |
64
|
|
|
'message' => 'You must define the uiComponent for this resource.', |
65
|
|
|
])); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths