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/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.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/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.php')
| -rw-r--r-- | vendor/doctrine/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.php b/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.php new file mode 100644 index 0000000..e2367ec --- /dev/null +++ b/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimePublicReflectionProperty.php | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\Persistence\Reflection; | ||
| 6 | |||
| 7 | use Doctrine\Common\Proxy\Proxy; | ||
| 8 | use ReflectionProperty; | ||
| 9 | use ReturnTypeWillChange; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * PHP Runtime Reflection Public Property - special overrides for public properties. | ||
| 13 | * | ||
| 14 | * @deprecated since version 3.1, use RuntimeReflectionProperty instead. | ||
| 15 | */ | ||
| 16 | class RuntimePublicReflectionProperty extends ReflectionProperty | ||
| 17 | { | ||
| 18 | /** | ||
| 19 | * {@inheritDoc} | ||
| 20 | * | ||
| 21 | * Returns the value of a public property without calling | ||
| 22 | * `__get` on the provided $object if it exists. | ||
| 23 | * | ||
| 24 | * @return mixed | ||
| 25 | */ | ||
| 26 | #[ReturnTypeWillChange] | ||
| 27 | public function getValue($object = null) | ||
| 28 | { | ||
| 29 | return $object !== null ? ((array) $object)[$this->getName()] ?? null : parent::getValue(); | ||
| 30 | } | ||
| 31 | |||
| 32 | /** | ||
| 33 | * {@inheritDoc} | ||
| 34 | * | ||
| 35 | * Avoids triggering lazy loading via `__set` if the provided object | ||
| 36 | * is a {@see \Doctrine\Common\Proxy\Proxy}. | ||
| 37 | * | ||
| 38 | * @link https://bugs.php.net/bug.php?id=63463 | ||
| 39 | * | ||
| 40 | * @param object|null $object | ||
| 41 | * @param mixed $value | ||
| 42 | * | ||
| 43 | * @return void | ||
| 44 | */ | ||
| 45 | #[ReturnTypeWillChange] | ||
| 46 | public function setValue($object, $value = null) | ||
| 47 | { | ||
| 48 | if (! ($object instanceof Proxy && ! $object->__isInitialized())) { | ||
| 49 | parent::setValue($object, $value); | ||
| 50 | |||
| 51 | return; | ||
| 52 | } | ||
| 53 | |||
| 54 | $originalInitializer = $object->__getInitializer(); | ||
| 55 | $object->__setInitializer(null); | ||
| 56 | |||
| 57 | parent::setValue($object, $value); | ||
| 58 | |||
| 59 | $object->__setInitializer($originalInitializer); | ||
| 60 | } | ||
| 61 | } | ||
