| @@ 130-160 (lines=31) @@ | ||
| 127 | ReflectionProperty $reflectionId |
|
| 128 | ) { |
|
| 129 | if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) { |
|
| 130 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| 131 | $proxy->__setInitializer(null); |
|
| 132 | $proxy->__setCloner(null); |
|
| 133 | ||
| 134 | if ($proxy->__isInitialized()) { |
|
| 135 | return; |
|
| 136 | } |
|
| 137 | ||
| 138 | $properties = $proxy->__getLazyProperties(); |
|
| 139 | ||
| 140 | foreach ($properties as $propertyName => $property) { |
|
| 141 | if ( ! isset($proxy->$propertyName)) { |
|
| 142 | $proxy->$propertyName = $properties[$propertyName]; |
|
| 143 | } |
|
| 144 | } |
|
| 145 | ||
| 146 | $proxy->__setInitialized(true); |
|
| 147 | $proxy->__wakeup(); |
|
| 148 | ||
| 149 | $id = $reflectionId->getValue($proxy); |
|
| 150 | ||
| 151 | if (null === $documentPersister->load(array('_id' => $id), $proxy)) { |
|
| 152 | if ( ! $this->lifecycleEventManager->documentNotFound($proxy, $id)) { |
|
| 153 | throw DocumentNotFoundException::documentNotFound(get_class($proxy), $id); |
|
| 154 | } |
|
| 155 | } |
|
| 156 | ||
| 157 | if ($proxy instanceof NotifyPropertyChanged) { |
|
| 158 | $proxy->addPropertyChangedListener($this->uow); |
|
| 159 | } |
|
| 160 | }; |
|
| 161 | } |
|
| 162 | ||
| 163 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| @@ 163-192 (lines=30) @@ | ||
| 160 | }; |
|
| 161 | } |
|
| 162 | ||
| 163 | return function (BaseProxy $proxy) use ($documentPersister, $reflectionId) { |
|
| 164 | $proxy->__setInitializer(null); |
|
| 165 | $proxy->__setCloner(null); |
|
| 166 | ||
| 167 | if ($proxy->__isInitialized()) { |
|
| 168 | return; |
|
| 169 | } |
|
| 170 | ||
| 171 | $properties = $proxy->__getLazyProperties(); |
|
| 172 | ||
| 173 | foreach ($properties as $propertyName => $property) { |
|
| 174 | if ( ! isset($proxy->$propertyName)) { |
|
| 175 | $proxy->$propertyName = $properties[$propertyName]; |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||
| 179 | $proxy->__setInitialized(true); |
|
| 180 | ||
| 181 | $id = $reflectionId->getValue($proxy); |
|
| 182 | ||
| 183 | if (null === $documentPersister->load(array('_id' => $id), $proxy)) { |
|
| 184 | if ( ! $this->lifecycleEventManager->documentNotFound($proxy, $id)) { |
|
| 185 | throw DocumentNotFoundException::documentNotFound(get_class($proxy), $id); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | ||
| 189 | if ($proxy instanceof NotifyPropertyChanged) { |
|
| 190 | $proxy->addPropertyChangedListener($this->uow); |
|
| 191 | } |
|
| 192 | }; |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|