diff options
| author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
| commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
| tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/orm/src/Cache/EntityCacheEntry.php | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/orm/src/Cache/EntityCacheEntry.php')
| -rw-r--r-- | vendor/doctrine/orm/src/Cache/EntityCacheEntry.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Cache/EntityCacheEntry.php b/vendor/doctrine/orm/src/Cache/EntityCacheEntry.php new file mode 100644 index 0000000..69bc813 --- /dev/null +++ b/vendor/doctrine/orm/src/Cache/EntityCacheEntry.php | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Cache; | ||
| 6 | |||
| 7 | use Doctrine\ORM\EntityManagerInterface; | ||
| 8 | |||
| 9 | use function array_map; | ||
| 10 | |||
| 11 | class EntityCacheEntry implements CacheEntry | ||
| 12 | { | ||
| 13 | /** | ||
| 14 | * @param array<string,mixed> $data The entity map data | ||
| 15 | * @psalm-param class-string $class The entity class name | ||
| 16 | */ | ||
| 17 | public function __construct( | ||
| 18 | public readonly string $class, | ||
| 19 | public readonly array $data, | ||
| 20 | ) { | ||
| 21 | } | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Creates a new EntityCacheEntry | ||
| 25 | * | ||
| 26 | * This method allows Doctrine\Common\Cache\PhpFileCache compatibility | ||
| 27 | * | ||
| 28 | * @param array<string,mixed> $values array containing property values | ||
| 29 | */ | ||
| 30 | public static function __set_state(array $values): self | ||
| 31 | { | ||
| 32 | return new self($values['class'], $values['data']); | ||
| 33 | } | ||
| 34 | |||
| 35 | /** | ||
| 36 | * Retrieves the entity data resolving cache entries | ||
| 37 | * | ||
| 38 | * @return array<string, mixed> | ||
| 39 | */ | ||
| 40 | public function resolveAssociationEntries(EntityManagerInterface $em): array | ||
| 41 | { | ||
| 42 | return array_map(static function ($value) use ($em) { | ||
| 43 | if (! ($value instanceof AssociationCacheEntry)) { | ||
| 44 | return $value; | ||
| 45 | } | ||
| 46 | |||
| 47 | return $em->getReference($value->class, $value->identifier); | ||
| 48 | }, $this->data); | ||
| 49 | } | ||
| 50 | } | ||
