src/Marshaler/Elastica/MappingFactory.php
protected function mapMessage(Field $field, \stdClass $rootObject, $path = null)
    {
        /** @var Message $class */
        $class = null;
        $anyOfClassNames = $field->getAnyOfClassNames();

        if (!empty($anyOfClassNames) && count($anyOfClassNames) === 1) {
            $class = current($anyOfClassNames);
            if (!class_exists($class)) {
                /*
                 * gdbots/pbjc compiler generates an interface and a concrete class with
                 * a V# suffix.  v1 would of course generally exist so we have a good chance
                 * of finding a class and thus a schema using this strategy.  we will however
                 * need to get fancier as versions increase and when mixins are used.
                 *
                 * fixme: address mapping messages that use a mixin as the anyOf
                 */
                $class = "{$class}V1";
            }
        }

        if (!empty($class) && class_exists($class)) {
            $schema = $class::schema();
            return [
                'type'       => $field->isAList() ? 'nested' : 'object',
                'properties' => $this->mapSchema($schema, $rootObject, $path),
            ];
        }

        return [
            'type'       => $field->isAList() ? 'nested' : 'object',
            'properties' => [
                Schema::PBJ_FIELD_NAME => [
                    'type'           => 'keyword',
                    'include_in_all' => false,
                ],
            ],
        ];
    }
protected function mapMessage(Field $field, \stdClass $rootObject, $path = null)
    {
        /** @var Message $class */
        $class = null;
        $anyOfClassNames = $field->getAnyOfClassNames();

        if (!empty($anyOfClassNames) && count($anyOfClassNames) === 1) {
            $class = current($anyOfClassNames);
            if (!class_exists($class)) {
                /*
                 * gdbots/pbjc compiler generates an interface and a concrete class with
                 * a V# suffix.  v1 would of course generally exist so we have a good chance
                 * of finding a class and thus a schema using this strategy.  we will however
                 * need to get fancier as versions increase and when mixins are used.
                 *
                 * fixme: address mapping messages that use a mixin as the anyOf
                 */
                $class = "{$class}V1";
            }
        }

        if (!empty($class) && class_exists($class)) {
            $schema = $class::schema();
            return [
                'type'       => $field->isAList() ? 'nested' : 'object',
                'properties' => $this->mapSchema($schema, $rootObject, $path),
            ];
        }

        return [
            'type'       => $field->isAList() ? 'nested' : 'object',
            'properties' => [
                Schema::PBJ_FIELD_NAME => [
                    'type'           => 'keyword',
                    'include_in_all' => false,
                ],
            ],
        ];
    }
protected function mapMessage ( Field $ field , \ stdClass $ rootObject , $ path = null ) { /** @var Message $class */ $ class = null ; $ anyOfClassNames = $ field -> getAnyOfClassNames ( ) ; if ( ! empty ( $ anyOfClassNames ) && count ( $ anyOfClassNames ) === 1 ) { $ class = current ( $ anyOfClassNames ) ; if ( ! class_exists ( $ class ) ) { /*
                 * gdbots/pbjc compiler generates an interface and a concrete class with
                 * a V# suffix.  v1 would of course generally exist so we have a good chance
                 * of finding a class and thus a schema using this strategy.  we will however
                 * need to get fancier as versions increase and when mixins are used.
                 *
                 * fixme: address mapping messages that use a mixin as the anyOf
                 */ $ class = "{$class}V1" ; } } if ( ! empty ( $ class ) && class_exists ( $ class ) ) { $ schema = $ class :: schema ( ) ; return [ 'type' => $ field -> isAList ( ) ? 'nested' : 'object' , 'properties' => $ this -> mapSchema ( $ schema , $ rootObject , $ path ) , ] ; } return [ 'type' => $ field -> isAList ( ) ? 'nested' : 'object' , 'properties' => [ Schema :: PBJ_FIELD_NAME => [ 'type' => 'keyword' , 'include_in_all' => false , ] , ] , ] ; }
@link https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html

@param Field     $field
@param \stdClass $rootObject
@param string    $path

@return array
@link https : // www . elastic . co / guide / en / elasticsearch / reference / current / nested . html