| @@ 107-141 (lines=35) @@ | ||
| 104 | ReflectionProperty $reflectionId |
|
| 105 | ) { |
|
| 106 | if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) { |
|
| 107 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| 108 | $proxy->__setInitializer(null); |
|
| 109 | $proxy->__setCloner(null); |
|
| 110 | ||
| 111 | if ($proxy->__isInitialized()) { |
|
| 112 | return; |
|
| 113 | } |
|
| 114 | ||
| 115 | $properties = $proxy->__getLazyProperties(); |
|
| 116 | ||
| 117 | foreach ($properties as $propertyName => $property) { |
|
| 118 | if (isset($proxy->$propertyName)) { |
|
| 119 | continue; |
|
| 120 | } |
|
| 121 | ||
| 122 | $proxy->$propertyName = $properties[$propertyName]; |
|
| 123 | } |
|
| 124 | ||
| 125 | $proxy->__setInitialized(true); |
|
| 126 | $proxy->__wakeup(); |
|
| 127 | ||
| 128 | $id = $reflectionId->getValue($proxy); |
|
| 129 | ||
| 130 | if ($documentPersister->load(['_id' => $id], $proxy) === null) { |
|
| 131 | if (! $this->lifecycleEventManager->documentNotFound($proxy, $id)) { |
|
| 132 | throw DocumentNotFoundException::documentNotFound(get_class($proxy), $id); |
|
| 133 | } |
|
| 134 | } |
|
| 135 | ||
| 136 | if (! ($proxy instanceof NotifyPropertyChanged)) { |
|
| 137 | return; |
|
| 138 | } |
|
| 139 | ||
| 140 | $proxy->addPropertyChangedListener($this->uow); |
|
| 141 | }; |
|
| 142 | } |
|
| 143 | ||
| 144 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| @@ 144-177 (lines=34) @@ | ||
| 141 | }; |
|
| 142 | } |
|
| 143 | ||
| 144 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| 145 | $proxy->__setInitializer(null); |
|
| 146 | $proxy->__setCloner(null); |
|
| 147 | ||
| 148 | if ($proxy->__isInitialized()) { |
|
| 149 | return; |
|
| 150 | } |
|
| 151 | ||
| 152 | $properties = $proxy->__getLazyProperties(); |
|
| 153 | ||
| 154 | foreach ($properties as $propertyName => $property) { |
|
| 155 | if (isset($proxy->$propertyName)) { |
|
| 156 | continue; |
|
| 157 | } |
|
| 158 | ||
| 159 | $proxy->$propertyName = $properties[$propertyName]; |
|
| 160 | } |
|
| 161 | ||
| 162 | $proxy->__setInitialized(true); |
|
| 163 | ||
| 164 | $id = $reflectionId->getValue($proxy); |
|
| 165 | ||
| 166 | if ($documentPersister->load(['_id' => $id], $proxy) === null) { |
|
| 167 | if (! $this->lifecycleEventManager->documentNotFound($proxy, $id)) { |
|
| 168 | throw DocumentNotFoundException::documentNotFound(get_class($proxy), $id); |
|
| 169 | } |
|
| 170 | } |
|
| 171 | ||
| 172 | if (! ($proxy instanceof NotifyPropertyChanged)) { |
|
| 173 | return; |
|
| 174 | } |
|
| 175 | ||
| 176 | $proxy->addPropertyChangedListener($this->uow); |
|
| 177 | }; |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|