@@ -81,84 +81,86 @@ And then create the corresponding entities, ``src/Entity/SonataClassificationTag
8181
8282 // src/Entity/SonataClassificationTag.php
8383
84+ use Doctrine\DBAL\Types\Types;
8485 use Doctrine\ORM\Mapping as ORM;
8586 use Sonata\ClassificationBundle\Entity\BaseTag;
8687
87- /**
88- * @ORM\Entity
89- * @ORM\Table(name="classification__tag")
90- */
88+ #[ORM\Entity]
89+ #[ORM\Table(name: 'classification__tag')]
9190 class SonataClassificationTag extends BaseTag
9291 {
93- /**
94- * @ORM\Id
95- * @ORM\GeneratedValue
96- * @ORM\Column(type="integer")
97- */
98- protected $id;
92+ #[ORM\Id]
93+ #[ORM\Column(type: Types::INTEGER)]
94+ #[ORM\GeneratedValue]
95+ protected ?int $id = null;
96+
97+ public function getId(): ?int
98+ {
99+ return $this->id;
100+ }
99101 }
100102
101103``src/Entity/SonataClassificationCategory ``::
102104
103105 // src/Entity/SonataClassificationCategory.php
104106
107+ use Doctrine\DBAL\Types\Types;
105108 use Doctrine\ORM\Mapping as ORM;
106109 use Sonata\ClassificationBundle\Entity\BaseCategory;
107110
108- /**
109- * @ORM\Entity
110- * @ORM\Table(name="classification__category")
111- */
111+ #[ORM\Entity]
112+ #[ORM\Table(name: 'classification__category')]
112113 class SonataClassificationCategory extends BaseCategory
113114 {
114- /**
115- * @ORM\Id
116- * @ORM\GeneratedValue
117- * @ORM\Column(type="integer")
118- */
119- protected $id;
115+ #[ORM\Id]
116+ #[ORM\Column(type: Types::INTEGER)]
117+ #[ORM\GeneratedValue]
118+ protected ?int $id = null;
119+
120+ public function getId(): ?int
121+ {
122+ return $this->id;
123+ }
120124 }
121125
122126``src/Entity/SonataClassificationCollection ``::
123127
124128 // src/Entity/SonataClassificationCollection.php
125129
130+ use Doctrine\DBAL\Types\Types;
126131 use Doctrine\ORM\Mapping as ORM;
127132 use Sonata\ClassificationBundle\Entity\BaseCollection;
128133
129- /**
130- * @ORM\Entity
131- * @ORM\Table(name="classification__collection")
132- */
134+ #[ORM\Entity]
135+ #[ORM\Table(name: 'classification__collection')]
133136 class SonataClassificationCollection extends BaseCollection
134137 {
135- /**
136- * @ORM\Id
137- * @ORM\GeneratedValue
138- * @ORM\Column(type="integer")
139- */
140- protected $id;
138+ #[ORM\Id]
139+ #[ORM\Column(type: Types::INTEGER)]
140+ #[ORM\GeneratedValue]
141+ protected ?int $id = null;
142+
143+ public function getId(): ?int
144+ {
145+ return $this->id;
146+ }
141147 }
142148
143149and ``src/Entity/SonataClassificationContext ``::
144150
145151 // src/Entity/SonataClassificationContext.php
146152
153+ use Doctrine\DBAL\Types\Types;
147154 use Doctrine\ORM\Mapping as ORM;
148155 use Sonata\ClassificationBundle\Entity\BaseContext;
149156
150- /**
151- * @ORM\Entity
152- * @ORM\Table(name="classification__context")
153- */
157+ #[ORM\Entity]
158+ #[ORM\Table(name: 'classification__context')]
154159 class SonataClassificationContext extends BaseContext
155160 {
156- /**
157- * @ORM\Id
158- * @ORM\GeneratedValue
159- * @ORM\Column(type="integer")
160- */
161- protected $id;
161+ #[ORM\Id]
162+ #[ORM\Column(type: Types::STRING)]
163+ protected ?string $id = null;
162164 }
163165
164166The only thing left is to update your schema::
@@ -172,71 +174,55 @@ You have to create the corresponding documents, ``src/Document/SonataClassificat
172174
173175 // src/Document/SonataClassificationTag.php
174176
175- use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB ;
177+ use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM ;
176178 use Sonata\ClassificationBundle\Document\BaseTag;
177179
178- /**
179- * @MongoDB\Document
180- */
180+ #[ODM\Document]
181181 class SonataClassificationTag extends BaseTag
182182 {
183- /**
184- * @MongoDB\Id
185- */
183+ #[ODM\Id]
186184 protected $id;
187185 }
188186
189187``src/Document/SonataClassificationCategory ``::
190188
191189 // src/Document/SonataClassificationCategory.php
192190
193- use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB ;
191+ use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM ;
194192 use Sonata\ClassificationBundle\Document\BaseCategory;
195193
196- /**
197- * @MongoDB\Document
198- */
194+ #[ODM\Document]
199195 class SonataClassificationCategory extends BaseCategory
200196 {
201- /**
202- * @MongoDB\Id
203- */
197+ #[ODM\Id]
204198 protected $id;
205199 }
206200
207201``src/Document/SonataClassificationCollection ``::
208202
209203 // src/Document/SonataClassificationCollection.php
210204
211- use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB ;
205+ use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM ;
212206 use Sonata\ClassificationBundle\Document\BaseCollection;
213207
214- /**
215- * @MongoDB\Document
216- */
208+ #[ODM\Document]
217209 class SonataClassificationCollection extends BaseCollection
218210 {
219- /**
220- * @MongoDB\Id
221- */
211+ #[ODM\Id]
222212 protected $id;
223213 }
224214
225215and ``src/Document/SonataClassificationContext ``::
226216
227217 // src/Document/SonataClassificationContext.php
228218
229- use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB ;
219+ use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM ;
230220 use Sonata\ClassificationBundle\Document\BaseContext;
231221
232- /**
233- * @MongoDB\Document
234- */
222+ #[ODM\Document]
235223 class SonataClassificationContext extends BaseContext
236224 {
237- /**
238- * @MongoDB\Id
239- */
225+ #[ODM\Id]
240226 protected $id;
241227 }
242228
0 commit comments