ControleOnline /
api-platform-common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Entity; |
||
| 4 | |||
| 5 | use Symfony\Component\Serializer\Attribute\Groups; |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | use ControleOnline\Repository\DistrictRepository; |
||
| 8 | use Doctrine\Common\Collections\ArrayCollection; |
||
|
0 ignored issues
–
show
The type
Doctrine\Common\Collections\ArrayCollection was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 9 | use Doctrine\Common\Collections\Collection; |
||
|
0 ignored issues
–
show
The type
Doctrine\Common\Collections\Collection was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 10 | use ControleOnline\Listener\LogListener; |
||
| 11 | use ApiPlatform\Metadata\ApiResource; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | use ApiPlatform\Metadata\Get; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use ApiPlatform\Metadata\GetCollection; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use Doctrine\ORM\Mapping\Column; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Column was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use Doctrine\ORM\Mapping\Entity; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Entity was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use Doctrine\ORM\Mapping\EntityListeners; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\EntityListeners was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | use Doctrine\ORM\Mapping\GeneratedValue; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\GeneratedValue was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use Doctrine\ORM\Mapping\Id; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Id was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 19 | use Doctrine\ORM\Mapping\Index; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Index was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | use Doctrine\ORM\Mapping\JoinColumn; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\JoinColumn was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 21 | use Doctrine\ORM\Mapping\ManyToOne; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\ManyToOne was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 22 | use Doctrine\ORM\Mapping\OneToMany; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\OneToMany was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 23 | use Doctrine\ORM\Mapping\Table; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Table was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 24 | |||
| 25 | #[ApiResource( |
||
| 26 | operations: [ |
||
| 27 | new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 28 | new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')') |
||
| 29 | ], |
||
| 30 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 31 | normalizationContext: ['groups' => ['district:read']], |
||
| 32 | denormalizationContext: ['groups' => ['district:write']] |
||
| 33 | )] |
||
| 34 | #[Table(name: 'district')] |
||
| 35 | #[Index(name: 'city_id', columns: ['city_id'])] |
||
| 36 | #[EntityListeners([LogListener::class])] |
||
| 37 | #[Entity(repositoryClass: DistrictRepository::class)] |
||
| 38 | class District |
||
| 39 | { |
||
| 40 | #[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
||
| 41 | #[Column(name: 'id', type: 'integer', nullable: false)] |
||
| 42 | #[Id] |
||
| 43 | #[GeneratedValue(strategy: 'IDENTITY')] |
||
| 44 | private int $id = 0; |
||
| 45 | |||
| 46 | #[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
||
| 47 | #[Column(name: 'district', type: 'string', length: 255, nullable: false)] |
||
| 48 | private string $district; |
||
| 49 | |||
| 50 | #[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
||
| 51 | #[JoinColumn(name: 'city_id', referencedColumnName: 'id', nullable: false)] |
||
| 52 | #[ManyToOne(targetEntity: City::class, inversedBy: 'district')] |
||
| 53 | private City $city; |
||
| 54 | |||
| 55 | #[OneToMany(targetEntity: Street::class, mappedBy: 'district')] |
||
| 56 | private Collection $street; |
||
| 57 | |||
| 58 | public function __construct() |
||
| 59 | { |
||
| 60 | $this->street = new ArrayCollection(); |
||
| 61 | } |
||
| 62 | |||
| 63 | public function getId(): int |
||
| 64 | { |
||
| 65 | return $this->id; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function setDistrict(string $district): self |
||
| 69 | { |
||
| 70 | $this->district = $district; |
||
| 71 | return $this; |
||
| 72 | } |
||
| 73 | |||
| 74 | public function getDistrict(): string |
||
| 75 | { |
||
| 76 | return strtoupper($this->district); |
||
| 77 | } |
||
| 78 | |||
| 79 | public function setCity(City $city): self |
||
| 80 | { |
||
| 81 | $this->city = $city; |
||
| 82 | return $this; |
||
| 83 | } |
||
| 84 | |||
| 85 | public function getCity(): City |
||
| 86 | { |
||
| 87 | return $this->city; |
||
| 88 | } |
||
| 89 | |||
| 90 | public function addStreet(Street $street): self |
||
| 91 | { |
||
| 92 | if (!$this->street->contains($street)) { |
||
| 93 | $this->street[] = $street; |
||
| 94 | } |
||
| 95 | return $this; |
||
| 96 | } |
||
| 97 | |||
| 98 | public function removeStreet(Street $street): self |
||
| 99 | { |
||
| 100 | $this->street->removeElement($street); |
||
| 101 | return $this; |
||
| 102 | } |
||
| 103 | |||
| 104 | public function getStreet(): Collection |
||
| 105 | { |
||
| 106 | return $this->street; |
||
| 107 | } |
||
| 108 | } |
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