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