public function getCompositions(SchemaBuilder $builder): array
    {
        $result = [];
        foreach ($this->reflection->getSchema() as $field => $type) {
            if (is_string($type) && $builder->hasSchema($type)) {
                $result[$field] = new CompositionDefinition(DocumentEntity::ONE, $type);
            }

            if (is_array($type) && isset($type[0]) && $builder->hasSchema($type[0])) {
                $result[$field] = new CompositionDefinition(DocumentEntity::MANY, $type[0]);
            }
        }

        return $result;
    }
public function getCompositions(SchemaBuilder $builder): array
    {
        $result = [];
        foreach ($this->reflection->getSchema() as $field => $type) {
            if (is_string($type) && $builder->hasSchema($type)) {
                $result[$field] = new CompositionDefinition(DocumentEntity::ONE, $type);
            }

            if (is_array($type) && isset($type[0]) && $builder->hasSchema($type[0])) {
                $result[$field] = new CompositionDefinition(DocumentEntity::MANY, $type[0]);
            }
        }

        return $result;
    }
public function getCompositions ( SchemaBuilder $ builder ) : array { $ result = [ ] ; foreach ( $ this -> reflection -> getSchema ( ) as $ field => $ type ) { if ( is_string ( $ type ) && $ builder -> hasSchema ( $ type ) ) { $ result [ $ field ] = new CompositionDefinition ( DocumentEntity :: ONE , $ type ) ; } if ( is_array ( $ type ) && isset ( $ type [ 0 ] ) && $ builder -> hasSchema ( $ type [ 0 ] ) ) { $ result [ $ field ] = new CompositionDefinition ( DocumentEntity :: MANY , $ type [ 0 ] ) ; } } return $ result ; }
Find all composition definitions, attention method require builder instance in order to
properly check that embedded class exists.

@param SchemaBuilder $builder

@return CompositionDefinition[]
Find all composition definitions attention method require builder instance in order to properly check that embedded class exists .