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,22 @@
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Repository\DomainEventRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DomainEventRepository::class)]
#[ApiResource(
operations: [
new Get(
uriTemplate: '/events/domain/{id}',
shortName: 'Domain Event',
class: DomainEvent::class,
normalizationContext: ['groups' => ['event:list']]
)
]
)]
class DomainEvent extends Event
{
#[ORM\ManyToOne(targetEntity: Domain::class, cascade: ['persist'], inversedBy: 'events')]