/** * @param array $params Parameters: * - collection: (string) The name of the storage collection. * - mongo_db: (Horde_Mongo_Client) [REQUIRED] The DB instance. */ public function __construct(array $params = array()) { if (!isset($params['mongo_db'])) { throw new InvalidArgumentException('Missing mongo_db parameter.'); } parent::__construct(array_merge(array('collection' => 'ingo_storage'), $params)); $this->_params['db'] = $this->_params['mongo_db']->selectCollection(null, $this->_params['collection']); }
/** * Create a filter iterator. * * @param Ingo_Storage $storage A storage object. * @param array $filter A list of rules (classnames) to filter. * * @return Ingo_Storage_FilterIterator Filtered iterator. */ public static function create(Ingo_Storage $storage, array $filter = array()) { $iterator = new static($storage->getIterator()); $iterator->setFilter($filter); return $iterator; }