@@ -33,7 +33,7 @@ public function __construct()
3333 private function getPropertiesByType ($ entity , $ type )
3434 {
3535 $ reflectionClass = new \ReflectionClass ($ entity );
36- $ properties = $ reflectionClass ->getProperties ();
36+ $ properties = array_merge ( $ reflectionClass ->getProperties (), $ this -> getParentProperties ( $ reflectionClass ) );
3737
3838 $ fields = array ();
3939 foreach ($ properties as $ property ) {
@@ -53,6 +53,21 @@ private function getPropertiesByType($entity, $type)
5353 return $ fields ;
5454 }
5555
56+ /**
57+ * @param \ReflectionClass $reflectionClass
58+ *
59+ * @return \ReflectionProperty[]
60+ */
61+ private function getParentProperties (\ReflectionClass $ reflectionClass )
62+ {
63+ $ parent = $ reflectionClass ->getParentClass ();
64+ if ($ parent == null ) {
65+ return array ();
66+ }
67+
68+ return $ parent ->getProperties ();
69+ }
70+
5671 /**
5772 * @param object $entity
5873 *
@@ -65,9 +80,10 @@ public function getFields($entity)
6580
6681 /**
6782 * @param object $entity
68- * @throws \InvalidArgumentException if the boost value is not numeric
6983 *
7084 * @return number
85+ *
86+ * @throws \InvalidArgumentException if the boost value is not numeric
7187 */
7288 public function getEntityBoost ($ entity )
7389 {
@@ -108,6 +124,7 @@ public function getDocumentIndex($entity)
108124
109125 /**
110126 * @param object $entity
127+ *
111128 * @return Type
112129 *
113130 * @throws \RuntimeException
@@ -165,6 +182,7 @@ public function getFieldMapping($entity)
165182
166183 /**
167184 * @param object $entity
185+ *
168186 * @return boolean
169187 */
170188 public function hasDocumentDeclaration ($ entity )
@@ -192,14 +210,20 @@ public function getSynchronizationCallback($entity)
192210
193211 /**
194212 * @param string $entity
195- * @param string $annotation
213+ * @param string $annotationName
196214 *
197215 * @return string
198216 */
199- private function getClassAnnotation ($ entity , $ annotation )
217+ private function getClassAnnotation ($ entity , $ annotationName )
200218 {
201219 $ reflectionClass = new \ReflectionClass ($ entity );
202220
203- return $ this ->reader ->getClassAnnotation ($ reflectionClass , $ annotation );
221+ $ annotation = $ this ->reader ->getClassAnnotation ($ reflectionClass , $ annotationName );
222+
223+ if ($ annotation === null && $ reflectionClass ->getParentClass ()) {
224+ $ annotation = $ this ->reader ->getClassAnnotation ($ reflectionClass ->getParentClass (), $ annotationName );
225+ }
226+
227+ return $ annotation ;
204228 }
205229}
0 commit comments