Skip to content

Commit 92fc633

Browse files
committed
refactor(entity): remove unnecessary entity annotations
- Simplified constructor by removing redundant #[Entity] annotations - Improved code clarity by leveraging type hints for entity identification
1 parent 930a44f commit 92fc633

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

doc/03_entity_class.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,21 @@ class Video extends \Spameri\Elastic\Entity\AbstractElasticEntity
211211
public function __construct(
212212
\Spameri\Elastic\Entity\Property\ElasticIdInterface $id,
213213

214-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\Identification::class)]
214+
// No #[Entity] needed - concrete class type is known from type hint
215215
private \SpameriTests\Elastic\Data\Entity\Video\Identification $identification,
216216

217217
private \SpameriTests\Elastic\Data\Entity\Property\Name $name,
218218

219219
private \SpameriTests\Elastic\Data\Entity\Property\Year $year,
220220

221-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\Technical::class)]
222221
private \SpameriTests\Elastic\Data\Entity\Video\Technical $technical,
223222

224-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\Story::class)]
225223
private \SpameriTests\Elastic\Data\Entity\Video\Story $story,
226224

227-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\Details::class)]
228225
private \SpameriTests\Elastic\Data\Entity\Video\Details $details,
229226

230-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\HighLights::class)]
231227
private \SpameriTests\Elastic\Data\Entity\Video\HighLights $highLights,
232228

233-
#[\Spameri\Elastic\Mapping\Entity(class: \SpameriTests\Elastic\Data\Entity\Video\Connections::class)]
234229
private \SpameriTests\Elastic\Data\Entity\Video\Connections $connections,
235230

236231
#[\Spameri\Elastic\Mapping\Collection]

0 commit comments

Comments
 (0)