protected function packAggregations(SchemaBuilder $builder): array
    {
        $result = [];
        foreach ($this->getAggregations() as $name => $aggregation) {
            if (!$builder->hasSchema($aggregation->getClass())) {
                throw new SchemaException(
                    "Aggregation {$this->getClass()}.'{$name}' refers to undefined document '{$aggregation->getClass()}'"
                );
            }

            if ($builder->getSchema($aggregation->getClass())->isEmbedded()) {
                throw new SchemaException(
                    "Aggregation {$this->getClass()}.'{$name}' refers to non storable document '{$aggregation->getClass()}'"
                );
            }

            $result[$name] = $aggregation->packSchema();
        }

        return $result;
    }
protected function packAggregations(SchemaBuilder $builder): array
    {
        $result = [];
        foreach ($this->getAggregations() as $name => $aggregation) {
            if (!$builder->hasSchema($aggregation->getClass())) {
                throw new SchemaException(
                    "Aggregation {$this->getClass()}.'{$name}' refers to undefined document '{$aggregation->getClass()}'"
                );
            }

            if ($builder->getSchema($aggregation->getClass())->isEmbedded()) {
                throw new SchemaException(
                    "Aggregation {$this->getClass()}.'{$name}' refers to non storable document '{$aggregation->getClass()}'"
                );
            }

            $result[$name] = $aggregation->packSchema();
        }

        return $result;
    }
protected function packAggregations ( SchemaBuilder $ builder ) : array { $ result = [ ] ; foreach ( $ this -> getAggregations ( ) as $ name => $ aggregation ) { if ( ! $ builder -> hasSchema ( $ aggregation -> getClass ( ) ) ) { throw new SchemaException ( "Aggregation {$this->getClass()}.'{$name}' refers to undefined document '{$aggregation->getClass()}'" ) ; } if ( $ builder -> getSchema ( $ aggregation -> getClass ( ) ) -> isEmbedded ( ) ) { throw new SchemaException ( "Aggregation {$this->getClass()}.'{$name}' refers to non storable document '{$aggregation->getClass()}'" ) ; } $ result [ $ name ] = $ aggregation -> packSchema ( ) ; } return $ result ; }
Pack aggregations into simple array definition.

@param SchemaBuilder $builder

@return array

@throws SchemaException
Pack aggregations into simple array definition .