|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace App\Blog\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use App\Blog\Tag\TagRepository; |
|
8
|
|
|
use Cycle\Annotated\Annotation\Column; |
|
|
|
|
|
|
9
|
|
|
use Cycle\Annotated\Annotation\Entity; |
|
|
|
|
|
|
10
|
|
|
use Cycle\Annotated\Annotation\Relation\ManyToMany; |
|
|
|
|
|
|
11
|
|
|
use Cycle\Annotated\Annotation\Table\Index; |
|
|
|
|
|
|
12
|
|
|
use Cycle\ORM\Collection\Pivoted\PivotedCollection; |
|
|
|
|
|
|
13
|
|
|
use Cycle\ORM\Entity\Behavior; |
|
|
|
|
|
|
14
|
|
|
use DateTimeImmutable; |
|
15
|
|
|
|
|
16
|
|
|
#[Entity(repository: TagRepository::class)] |
|
17
|
|
|
#[Index(columns: ['label'], unique: true)] |
|
18
|
|
|
#[Behavior\CreatedAt(field: 'created_at', column: 'created_at')] |
|
19
|
|
|
class Tag |
|
20
|
|
|
{ |
|
21
|
|
|
#[Column(type: 'primary')] |
|
22
|
|
|
private ?int $id = null; |
|
23
|
|
|
|
|
24
|
|
|
#[Column(type: 'string(191)')] |
|
25
|
|
|
private string $label; |
|
26
|
|
|
|
|
27
|
|
|
#[Column(type: 'datetime')] |
|
28
|
|
|
private DateTimeImmutable $created_at; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var PivotedCollection<array-key, Post, PostTag> |
|
32
|
|
|
*/ |
|
33
|
|
|
#[ManyToMany(target: Post::class, though: PostTag::class, fkAction: 'CASCADE', indexCreate: false)] |
|
34
|
|
|
private PivotedCollection $posts; |
|
35
|
|
|
|
|
36
|
|
|
public function __construct(string $label) |
|
37
|
|
|
{ |
|
38
|
|
|
$this->label = $label; |
|
39
|
|
|
$this->created_at = new DateTimeImmutable(); |
|
40
|
|
|
$this->posts = new PivotedCollection(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getId(): ?int |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->id; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getLabel(): string |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->label; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function setLabel(string $label): void |
|
54
|
|
|
{ |
|
55
|
|
|
$this->label = $label; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getCreatedAt(): DateTimeImmutable |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->created_at; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return Post[] |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getPosts(): array |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->posts->toArray(); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function addPost(Post $post): void |
|
72
|
|
|
{ |
|
73
|
|
|
$this->posts->add($post); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
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