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