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