Skip to content

Commit

Permalink
Add 2.9.4 support (#23)
Browse files Browse the repository at this point in the history
* Add 2.9.4 support

* update readme
  • Loading branch information
sspat authored Jan 17, 2022
1 parent 43dd8ad commit 718aadf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.9.4 doctrine/orm:2.9.4`
- run `composer require sspat/doctrine-nullable-embeddables:v2.9.3 doctrine/orm:2.9.3`
- run `composer require sspat/doctrine-nullable-embeddables:v2.9.2 doctrine/orm:2.9.2`
- run `composer require sspat/doctrine-nullable-embeddables:v2.9.1 doctrine/orm:2.9.1`
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": "^7.4|^8.0",
"cweagans/composer-patches": "^1.6|^1.7",
"doctrine/orm": "2.9.3"
"doctrine/orm": "2.9.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
Expand All @@ -31,7 +31,7 @@
"extra": {
"patches": {
"doctrine/orm": {
"Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.9.3/patch/nullable_embeddables.patch"
"Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.9.4/patch/nullable_embeddables.patch"
}
}
},
Expand Down
9 changes: 5 additions & 4 deletions patch/nullable_embeddables.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
diff --git a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
index d08be94..47bc91d 100644
index 4a89c90..60f67be 100644
--- a/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
+++ b/lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
@@ -65,13 +65,15 @@ class ReflectionEmbeddedProperty extends ReflectionProperty
@@ -67,13 +67,16 @@ class ReflectionEmbeddedProperty extends ReflectionProperty
#[ReturnTypeWillChange]
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;

Expand All @@ -20,7 +21,7 @@ index d08be94..47bc91d 100644
}

/**
@@ -80,7 +82,20 @@ class ReflectionEmbeddedProperty extends ReflectionProperty
@@ -84,7 +87,20 @@ class ReflectionEmbeddedProperty extends ReflectionProperty
#[ReturnTypeWillChange]
public function setValue($object, $value = null)
{
Expand Down

0 comments on commit 718aadf

Please sign in to comment.