private function getParentFields(ClassMetadata $class, $fields = array())
    {
        if ($parent = $this->classStore->getParent($class)) {
            $parentFields = $parent->getFieldNames();

            foreach ($parentFields as $field) {
                if (!in_array($field, $fields)) {
                    $fields[] = $field;
                }
            }

            $fields = $this->getParentFields($parent, $fields);
        }

        return $fields;
    }