src/Search/Framework/CollectionAgentAbstract.php
public function loadSchemata()
    {
        $fused_options = array();
        foreach ($this->_collections as $collection) {
            $context = array('collection' => $collection->getId());

            $schema_options = $this->loadCollectionSchema($collection)->toArray();

            // Just set the schema options on the first pass.
            if (!$fused_options) {
                $fused_options = $schema_options;
                continue;
            }

            // The unique field must be the same across collections.
            if ($schema_options['unique_field'] != $fused_options['unique_field']) {
                $message = 'Collections must have the same unique field.';
                throw new \InvalidArgumentException($message);
            }

            // Define the field or check for field incompatibilities.
            foreach ($schema_options['fields'] as $field_id => $field_options) {
                if (!isset($fused_options['fields'][$field_id])) {
                    $fused_options['fields'][$field_id] = $field_options;
                } elseif ($fused_options['fields'][$field_id] != $field_options) {
                    $message = 'Field definitions for "'. $field_id . '"must match.';
                    throw new \InvalidArgumentException($message);
                }
            }
        }

        // Build the fused schema.
        $schema = new Schema();
        $schema->build($fused_options);

        // Populate the field type cache.
        foreach ($schema as $id => $field) {
            $this->_fieldTypes[$id] = $field->getType();
        }

        return $schema;
    }
public function loadSchemata()
    {
        $fused_options = array();
        foreach ($this->_collections as $collection) {
            $context = array('collection' => $collection->getId());

            $schema_options = $this->loadCollectionSchema($collection)->toArray();

            // Just set the schema options on the first pass.
            if (!$fused_options) {
                $fused_options = $schema_options;
                continue;
            }

            // The unique field must be the same across collections.
            if ($schema_options['unique_field'] != $fused_options['unique_field']) {
                $message = 'Collections must have the same unique field.';
                throw new \InvalidArgumentException($message);
            }

            // Define the field or check for field incompatibilities.
            foreach ($schema_options['fields'] as $field_id => $field_options) {
                if (!isset($fused_options['fields'][$field_id])) {
                    $fused_options['fields'][$field_id] = $field_options;
                } elseif ($fused_options['fields'][$field_id] != $field_options) {
                    $message = 'Field definitions for "'. $field_id . '"must match.';
                    throw new \InvalidArgumentException($message);
                }
            }
        }

        // Build the fused schema.
        $schema = new Schema();
        $schema->build($fused_options);

        // Populate the field type cache.
        foreach ($schema as $id => $field) {
            $this->_fieldTypes[$id] = $field->getType();
        }

        return $schema;
    }
public function loadSchemata ( ) { $ fused_options = array ( ) ; foreach ( $ this -> _collections as $ collection ) { $ context = array ( 'collection' => $ collection -> getId ( ) ) ; $ schema_options = $ this -> loadCollectionSchema ( $ collection ) -> toArray ( ) ; // Just set the schema options on the first pass. if ( ! $ fused_options ) { $ fused_options = $ schema_options ; continue ; } // The unique field must be the same across collections. if ( $ schema_options [ 'unique_field' ] != $ fused_options [ 'unique_field' ] ) { $ message = 'Collections must have the same unique field.' ; throw new \ InvalidArgumentException ( $ message ) ; } // Define the field or check for field incompatibilities. foreach ( $ schema_options [ 'fields' ] as $ field_id => $ field_options ) { if ( ! isset ( $ fused_options [ 'fields' ] [ $ field_id ] ) ) { $ fused_options [ 'fields' ] [ $ field_id ] = $ field_options ; } elseif ( $ fused_options [ 'fields' ] [ $ field_id ] != $ field_options ) { $ message = 'Field definitions for "' . $ field_id . '"must match.' ; throw new \ InvalidArgumentException ( $ message ) ; } } } // Build the fused schema. $ schema = new Schema ( ) ; $ schema -> build ( $ fused_options ) ; // Populate the field type cache. foreach ( $ schema as $ id => $ field ) { $ this -> _fieldTypes [ $ id ] = $ field -> getType ( ) ; } return $ schema ; }
Loads and fuses the schemata for all collections attached to this agent.

@return Schema
Loads and fuses the schemata for all collections attached to this agent .