feat: add API Platform

This commit is contained in:
Maël Gangloff
2024-07-17 00:19:27 +02:00
parent 16610205b6
commit 36a76f2876
18 changed files with 489 additions and 3 deletions

View File

@@ -2,10 +2,24 @@
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Repository\EntityEventRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntityEventRepository::class)]
#[ApiResource(
operations: [
new Get(
uriTemplate: '/events/entity/{id}',
shortName: 'Entity Event',
class: EntityEvent::class,
normalizationContext: [
'groups' => ['event:list']
]
)
]
)]
class EntityEvent extends Event
{
@@ -14,7 +28,6 @@ class EntityEvent extends Event
private ?Entity $entity = null;
public function getEntity(): ?Entity
{
return $this->entity;