ezcSearchDocumentDefinition) */ private $cache = array(); /** * Constructs a new embedded manager. */ public function __construct() { } /** * Returns the definition of the search document with the type $type. * * @throws ezcSearchDoesNotProvideDefinitionException if no such definition can be found. * @throws ezcSearchDefinitionInvalidException * if the definition does not have an "idProperty" attribute. * @param string $type * @return ezcSearchDocumentDefinition */ public function fetchDefinition( $type ) { // check the cache if ( isset( $this->cache[$type] ) ) { return $this->cache[$type]; } // check for interface implementation if ( !in_array( 'ezcSearchDefinitionProvider', class_implements( $type ) ) ) { throw new ezcSearchDoesNotProvideDefinitionException( $type ); } // load definition $definition = call_user_func( array( $type, 'getDefinition' ) ); if ( $definition->idProperty === null ) { throw new ezcSearchDefinitionInvalidException( 'embedded', $type, null, 'Missing ID property' ); } // store in cache $this->cache[$type] = $definition; // return return $definition; } } ?>