From ca49d9a1d93548a3596242ed5bf66065508ac78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Nork=C5=ABnas?= Date: Wed, 17 Dec 2025 14:49:37 +0200 Subject: [PATCH] Drop doctrine annotations --- .gitignore | 1 + tests/Entity/Article.php | 3 -- tests/Entity/Car.php | 3 -- tests/Entity/Comment.php | 31 +----------------- tests/Entity/ContentAggregator.php | 3 -- tests/Entity/ContentItem.php | 19 ------------ tests/Entity/DummyCustomGroups.php | 24 +------------- tests/Entity/DynamicSettings.php | 13 -------- tests/Entity/EmptyAggregator.php | 3 -- tests/Entity/Image.php | 13 -------- tests/Entity/Link.php | 17 ---------- tests/Entity/Page.php | 24 +------------- tests/Entity/Podcast.php | 3 -- tests/Entity/Post.php | 50 ++---------------------------- tests/Entity/SelfNormalizable.php | 16 ---------- tests/Entity/Tag.php | 17 ---------- 16 files changed, 7 insertions(+), 233 deletions(-) diff --git a/.gitignore b/.gitignore index 427199d6..e405744a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ composer.lock /vendor/ /var/ phpstan.neon +/config/reference.php # Meilisearch /data.ms/* diff --git a/tests/Entity/Article.php b/tests/Entity/Article.php index a1e588ba..dbe6b87d 100644 --- a/tests/Entity/Article.php +++ b/tests/Entity/Article.php @@ -6,9 +6,6 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ #[ORM\Entity] class Article extends ContentItem { diff --git a/tests/Entity/Car.php b/tests/Entity/Car.php index 90fc2e51..23f43177 100644 --- a/tests/Entity/Car.php +++ b/tests/Entity/Car.php @@ -6,9 +6,6 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ #[ORM\Entity] class Car { diff --git a/tests/Entity/Comment.php b/tests/Entity/Comment.php index 311fcdfb..a952eff0 100644 --- a/tests/Entity/Comment.php +++ b/tests/Entity/Comment.php @@ -6,55 +6,26 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; -/** - * @ORM\Entity - * - * @ORM\Table(name="comments") - */ #[ORM\Entity] #[ORM\Table(name: 'comments')] class Comment { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer", nullable=true) - * - * @Groups({"searchable"}) - */ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: Types::INTEGER)] #[Groups('searchable')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Post", inversedBy="comments") - * - * @ORM\JoinColumn(nullable=false) - */ #[ORM\ManyToOne(inversedBy: 'comments')] #[ORM\JoinColumn(nullable: false)] private Post $post; - /** - * @ORM\Column(type="text") - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::TEXT)] #[Groups('searchable')] private string $content; - /** - * @ORM\Column(type="datetime_immutable") - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups('searchable')] private \DateTimeImmutable $publishedAt; diff --git a/tests/Entity/ContentAggregator.php b/tests/Entity/ContentAggregator.php index 2346f168..503b6d0d 100644 --- a/tests/Entity/ContentAggregator.php +++ b/tests/Entity/ContentAggregator.php @@ -7,9 +7,6 @@ use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Entity\Aggregator; -/** - * @ORM\Entity - */ #[ORM\Entity] class ContentAggregator extends Aggregator { diff --git a/tests/Entity/ContentItem.php b/tests/Entity/ContentItem.php index 8f1aa33e..cd188e3d 100644 --- a/tests/Entity/ContentItem.php +++ b/tests/Entity/ContentItem.php @@ -7,36 +7,17 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\InheritanceType("JOINED") - * - * @ORM\DiscriminatorColumn(name="type", type="integer") - * - * @ORM\DiscriminatorMap({1 = Article::class, 2 = Podcast::class}) - */ #[ORM\Entity] #[ORM\InheritanceType('JOINED')] #[ORM\DiscriminatorColumn(name: 'type', type: 'integer')] #[ORM\DiscriminatorMap([1 => Article::class, 2 => Podcast::class])] abstract class ContentItem { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $title; diff --git a/tests/Entity/DummyCustomGroups.php b/tests/Entity/DummyCustomGroups.php index d7923584..8f60bd3e 100644 --- a/tests/Entity/DummyCustomGroups.php +++ b/tests/Entity/DummyCustomGroups.php @@ -6,42 +6,20 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; -/** - * @ORM\Entity - */ #[ORM\Entity] class DummyCustomGroups { - /** - * @ORM\Id - * - * @ORM\Column(type="integer") - * - * @ORM\GeneratedValue("NONE") - * - * @Groups("public") - */ #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] #[Groups('public')] private int $id; - /** - * @ORM\Column(type="string") - * - * @Groups("public") - */ #[ORM\Column(type: Types::STRING)] #[Groups('public')] private string $name; - /** - * @ORM\Column(type="datetime_immutable") - * - * @Groups("private") - */ #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups('private')] private \DateTimeImmutable $createdAt; diff --git a/tests/Entity/DynamicSettings.php b/tests/Entity/DynamicSettings.php index b475319e..20ef22c0 100644 --- a/tests/Entity/DynamicSettings.php +++ b/tests/Entity/DynamicSettings.php @@ -7,26 +7,13 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ #[ORM\Entity] class DynamicSettings { - /** - * @ORM\Id - * - * @ORM\Column(type="integer") - * - * @ORM\GeneratedValue("NONE") - */ #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $name; diff --git a/tests/Entity/EmptyAggregator.php b/tests/Entity/EmptyAggregator.php index ae622370..6dd32e89 100644 --- a/tests/Entity/EmptyAggregator.php +++ b/tests/Entity/EmptyAggregator.php @@ -7,9 +7,6 @@ use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Entity\Aggregator; -/** - * @ORM\Entity - */ #[ORM\Entity] class EmptyAggregator extends Aggregator { diff --git a/tests/Entity/Image.php b/tests/Entity/Image.php index 7f9fc78d..fe83db08 100644 --- a/tests/Entity/Image.php +++ b/tests/Entity/Image.php @@ -7,27 +7,14 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ #[ORM\Entity] class Image { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $url; diff --git a/tests/Entity/Link.php b/tests/Entity/Link.php index ec67b15f..5c636570 100644 --- a/tests/Entity/Link.php +++ b/tests/Entity/Link.php @@ -10,36 +10,19 @@ use Symfony\Component\Serializer\Normalizer\NormalizableInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -/** - * @ORM\Entity - */ #[ORM\Entity] class Link implements NormalizableInterface { - /** - * @ORM\Id - * - * @ORM\Column(type="integer") - */ #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $name; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $url; - /** - * @ORM\Column(type="boolean", options={"default"=false}) - */ #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])] private bool $isSponsored; diff --git a/tests/Entity/Page.php b/tests/Entity/Page.php index 2c30e2d6..1c02fde7 100644 --- a/tests/Entity/Page.php +++ b/tests/Entity/Page.php @@ -7,43 +7,21 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Meilisearch\Bundle\Tests\Entity\ObjectId\DummyObjectId; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; -/** - * @ORM\Entity - * - * @ORM\Table(name="pages") - */ #[ORM\Entity] #[ORM\Table(name: 'pages')] class Page { - /** - * @ORM\Id - * - * @ORM\GeneratedValue(strategy="NONE") - * - * @ORM\Column(type="dummy_object_id") - */ #[ORM\Id] #[ORM\GeneratedValue(strategy: 'NONE')] #[ORM\Column(type: 'dummy_object_id')] private DummyObjectId $id; - /** - * @ORM\Column(type="string", nullable=true) - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::STRING)] #[Groups('searchable')] private string $title; - /** - * @ORM\Column(type="text", nullable=true) - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::TEXT)] #[Groups('searchable')] private string $content; diff --git a/tests/Entity/Podcast.php b/tests/Entity/Podcast.php index ff800217..a7c6cc2f 100644 --- a/tests/Entity/Podcast.php +++ b/tests/Entity/Podcast.php @@ -6,9 +6,6 @@ use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - */ #[ORM\Entity] class Podcast extends ContentItem { diff --git a/tests/Entity/Post.php b/tests/Entity/Post.php index e2ae2a8e..19ae18e9 100644 --- a/tests/Entity/Post.php +++ b/tests/Entity/Post.php @@ -8,72 +8,32 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; -/** - * @ORM\Entity - * - * @ORM\Table(name="posts") - */ #[ORM\Entity] #[ORM\Table(name: 'posts')] class Post { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Groups({"searchable"}) - */ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: Types::INTEGER)] #[Groups('searchable')] private ?int $id = null; - /** - * @ORM\Column(type="string", nullable=true) - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::STRING, nullable: true)] #[Groups('searchable')] private ?string $title; - /** - * @ORM\Column(type="text", nullable=true) - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups('searchable')] private ?string $content; - /** - * @ORM\Column(type="datetime_immutable") - * - * @Groups({"searchable"}) - */ #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups('searchable')] private \DateTimeImmutable $publishedAt; /** * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Comment", - * mappedBy="post", - * cascade={"persist"}, - * orphanRemoval=true - * ) - * - * @ORM\OrderBy({"publishedAt": "DESC"}) - * - * @Groups({"searchable"}) */ #[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'post', cascade: ['persist'], orphanRemoval: true)] #[ORM\OrderBy(['publishedAt' => 'DESC'])] @@ -98,9 +58,7 @@ public function setTitle(string $title): void $this->title = $title; } - /** - * @Groups({"searchable"}) - */ + #[Groups('searchable')] public function getTitle(): ?string { return $this->title; @@ -111,9 +69,7 @@ public function getContent(): ?string return $this->content; } - /** - * @Groups({"searchable"}) - */ + #[Groups('searchable')] public function getPublishedAt(): \DateTimeImmutable { return $this->publishedAt; diff --git a/tests/Entity/SelfNormalizable.php b/tests/Entity/SelfNormalizable.php index 95bfca54..ca33e37e 100644 --- a/tests/Entity/SelfNormalizable.php +++ b/tests/Entity/SelfNormalizable.php @@ -10,32 +10,16 @@ use Symfony\Component\Serializer\Normalizer\NormalizableInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -/** - * @ORM\Entity - */ #[ORM\Entity] class SelfNormalizable implements NormalizableInterface { - /** - * @ORM\Id - * - * @ORM\Column(type="integer") - * - * @ORM\GeneratedValue("NONE") - */ #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $name; - /** - * @ORM\Column(type="datetime_immutable") - */ #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $createdAt; diff --git a/tests/Entity/Tag.php b/tests/Entity/Tag.php index 1bf5a3ab..8a2bad68 100644 --- a/tests/Entity/Tag.php +++ b/tests/Entity/Tag.php @@ -11,38 +11,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizableInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -/** - * @ORM\Entity - */ #[ORM\Entity] class Tag implements NormalizableInterface { - /** - * @ORM\Id - * - * @ORM\Column(type="integer") - */ #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="string") - */ #[ORM\Column(type: Types::STRING)] private string $name; - /** - * @ORM\Column(type="smallint") - */ #[ORM\Column(type: Types::SMALLINT)] private int $count = 0; private bool $public = true; - /** - * @ORM\Column(type="datetime_immutable") - */ #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $publishedAt;