Skip to content

Commit 02b16a0

Browse files
committed
feat(entity): add lazy loading support for collections
- Created EntityWithElasticCollection for testing lazy loading - Added LazyLoadingTest to verify collection initialization behavior - Implemented various tests for lazy loading scenarios
1 parent 3d634a5 commit 02b16a0

File tree

2 files changed

+702
-0
lines changed

2 files changed

+702
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace SpameriTests\Elastic\Data\Entity;
4+
5+
/**
6+
* Entity with an ElasticEntityCollection for testing lazy loading of elastic collections.
7+
*/
8+
class EntityWithElasticCollection extends \Spameri\Elastic\Entity\AbstractElasticEntity
9+
{
10+
11+
/**
12+
* @param \Spameri\Elastic\Entity\Collection\ElasticEntityCollection<\SpameriTests\Elastic\Data\Entity\SimpleTestEntity> $related
13+
*/
14+
public function __construct(
15+
#[\Spameri\Elastic\Mapping\Entity(class: \Spameri\Elastic\Entity\Property\ElasticId::class)]
16+
public \Spameri\Elastic\Entity\Property\ElasticIdInterface $id,
17+
public string $name,
18+
#[\Spameri\Elastic\Mapping\ElasticCollection(class: \SpameriTests\Elastic\Data\Entity\SimpleTestEntity::class)]
19+
public \Spameri\Elastic\Entity\Collection\ElasticEntityCollection $related,
20+
)
21+
{
22+
parent::__construct($id);
23+
}
24+
25+
}

0 commit comments

Comments
 (0)