diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index d8084e6..10fc551 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -29,14 +29,6 @@ jobs: coverage: "pcov" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 - - name: "Cache dependencies" - uses: "actions/cache@v2" - with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" diff --git a/README.md b/README.md index 341d5d1..1a4706e 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,7 @@ If you choose this path, you can install this package in the following steps: ``` Then depending on the version of doctrine/orm you want to use: +- run `composer require sspat/doctrine-nullable-embeddables:v2.8.2 doctrine/orm` - run `composer require sspat/doctrine-nullable-embeddables:v2.8.1 doctrine/orm` - run `composer require sspat/doctrine-nullable-embeddables:v2.8.0 doctrine/orm` - run `composer require sspat/doctrine-nullable-embeddables:v2.7.5 doctrine/orm` diff --git a/composer.json b/composer.json index 1b778a7..c6a00c0 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^7.4|^8.0", "cweagans/composer-patches": "^1.6|^1.7", - "doctrine/orm": "2.8.1" + "doctrine/orm": "2.8.2" }, "require-dev": { "phpunit/phpunit": "^9.5" @@ -31,7 +31,7 @@ "extra": { "patches": { "doctrine/orm": { - "Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.8.1/patch/nullable_embeddables.patch" + "Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.8.2/patch/nullable_embeddables.patch" } } }, diff --git a/patch/nullable_embeddables.patch b/patch/nullable_embeddables.patch index f3e2fee..b7b568d 100644 --- a/patch/nullable_embeddables.patch +++ b/patch/nullable_embeddables.patch @@ -1,27 +1,26 @@ diff --git a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php -index b224fff4e..13404d91a 100644 +index 49a2ab2..8f3d6f7 100644 --- a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php +++ b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php -@@ -72,13 +72,16 @@ class ReflectionEmbeddedProperty extends ReflectionProperty +@@ -63,13 +63,15 @@ class ReflectionEmbeddedProperty extends ReflectionProperty */ public function getValue($object = null) { - $embeddedObject = $this->parentProperty->getValue($object); -+ $embeddedObject = ! $this->parentProperty->getDeclaringClass()->isInstance($object) || -+ $this->parentProperty->isInitialized($object) ? ++ $embeddedObject = ! $this->parentProperty->getDeclaringClass()->isInstance($object) || $this->parentProperty->isInitialized($object) ? + $this->parentProperty->getValue($object) : + null; - - if (null === $embeddedObject) { + + if ($embeddedObject === null) { return null; } - + - return $this->childProperty->getValue($embeddedObject); + return $this->childProperty->isInitialized($embeddedObject) ? $this->childProperty->getValue($embeddedObject) : null; } - + /** -@@ -86,7 +89,21 @@ class ReflectionEmbeddedProperty extends ReflectionProperty +@@ -77,7 +79,20 @@ class ReflectionEmbeddedProperty extends ReflectionProperty */ public function setValue($object, $value = null) { @@ -37,10 +36,9 @@ index b224fff4e..13404d91a 100644 + return; + } + -+ $embeddedObject = ! $this->parentProperty->getDeclaringClass()->isInstance($object) || -+ $this->parentProperty->isInitialized($object) ? ++ $embeddedObject = ! $this->parentProperty->getDeclaringClass()->isInstance($object) || $this->parentProperty->isInitialized($object) ? + $this->parentProperty->getValue($object) : + null; - - if (null === $embeddedObject) { + + if ($embeddedObject === null) { $this->instantiator = $this->instantiator ?: new Instantiator();