public function any($type)
    {
        if ($this->_toolbox->getTransactionManager()->hasTransaction()) {
            $this->_toolbox->getTransactionManager()->addReadCollection($type);
            $this->_toolbox->getTransactionManager()->addCommand("db.$type.any();" , "Finder:any", null, false, array('type' => $type));
        } else {
            try {
                $result = $this->_toolbox->getCollectionHandler()->any($type);

                if (!$result) {
                    return null;
                }

                $converted = $this->convertToPods($type, array($result));

                return reset($converted);

            } catch (\Exception $e) {
                $normalised = $this->_toolbox->normaliseDriverExceptions($e);
                throw new FinderException($normalised['message'], $normalised['code']);
            }
        }
    }
public function any($type)
    {
        if ($this->_toolbox->getTransactionManager()->hasTransaction()) {
            $this->_toolbox->getTransactionManager()->addReadCollection($type);
            $this->_toolbox->getTransactionManager()->addCommand("db.$type.any();" , "Finder:any", null, false, array('type' => $type));
        } else {
            try {
                $result = $this->_toolbox->getCollectionHandler()->any($type);

                if (!$result) {
                    return null;
                }

                $converted = $this->convertToPods($type, array($result));

                return reset($converted);

            } catch (\Exception $e) {
                $normalised = $this->_toolbox->normaliseDriverExceptions($e);
                throw new FinderException($normalised['message'], $normalised['code']);
            }
        }
    }
public function any ( $ type ) { if ( $ this -> _toolbox -> getTransactionManager ( ) -> hasTransaction ( ) ) { $ this -> _toolbox -> getTransactionManager ( ) -> addReadCollection ( $ type ) ; $ this -> _toolbox -> getTransactionManager ( ) -> addCommand ( "db.$type.any();" , "Finder:any" , null , false , array ( 'type' => $ type ) ) ; } else { try { $ result = $ this -> _toolbox -> getCollectionHandler ( ) -> any ( $ type ) ; if ( ! $ result ) { return null ; } $ converted = $ this -> convertToPods ( $ type , array ( $ result ) ) ; return reset ( $ converted ) ; } catch ( \ Exception $ e ) { $ normalised = $ this -> _toolbox -> normaliseDriverExceptions ( $ e ) ; throw new FinderException ( $ normalised [ 'message' ] , $ normalised [ 'code' ] ) ; } } }
Returns a random document from a collection.
@param  string          $type The collection we want to get the document from.
@throws FinderException
@return AModel
Returns a random document from a collection .