public function fetch($query, $mode)
    {
        $context = $this->getCommandContext();
        $context->mode = $mode;
        $context->query = $query;
        $context->repository = $query->getRepository();

        if ($this->getCommandChain()->run('before.fetch', $context) !== false) {
            $modes = array(
                    AnDomain::FETCH_ROW => AnDatabase::FETCH_ARRAY,
                    AnDomain::FETCH_ROW_LIST => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_ENTITY => AnDatabase::FETCH_ARRAY,
                    AnDomain::FETCH_ENTITY_SET => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_ENTITY_LIST => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_VALUE => AnDatabase::FETCH_FIELD,
                    AnDomain::FETCH_VALUE_LIST => AnDatabase::FETCH_FIELD_LIST,
            );

            $mode = $modes[$mode];

            $context['data'] = $this->_adapter->select(to_str($query), $mode);

            $this->getCommandChain()->run('after.fetch', $context);
        }

        return $context->data;
    }
public function fetch($query, $mode)
    {
        $context = $this->getCommandContext();
        $context->mode = $mode;
        $context->query = $query;
        $context->repository = $query->getRepository();

        if ($this->getCommandChain()->run('before.fetch', $context) !== false) {
            $modes = array(
                    AnDomain::FETCH_ROW => AnDatabase::FETCH_ARRAY,
                    AnDomain::FETCH_ROW_LIST => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_ENTITY => AnDatabase::FETCH_ARRAY,
                    AnDomain::FETCH_ENTITY_SET => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_ENTITY_LIST => AnDatabase::FETCH_ARRAY_LIST,
                    AnDomain::FETCH_VALUE => AnDatabase::FETCH_FIELD,
                    AnDomain::FETCH_VALUE_LIST => AnDatabase::FETCH_FIELD_LIST,
            );

            $mode = $modes[$mode];

            $context['data'] = $this->_adapter->select(to_str($query), $mode);

            $this->getCommandChain()->run('after.fetch', $context);
        }

        return $context->data;
    }
public function fetch ( $ query , $ mode ) { $ context = $ this -> getCommandContext ( ) ; $ context -> mode = $ mode ; $ context -> query = $ query ; $ context -> repository = $ query -> getRepository ( ) ; if ( $ this -> getCommandChain ( ) -> run ( 'before.fetch' , $ context ) !== false ) { $ modes = array ( AnDomain :: FETCH_ROW => AnDatabase :: FETCH_ARRAY , AnDomain :: FETCH_ROW_LIST => AnDatabase :: FETCH_ARRAY_LIST , AnDomain :: FETCH_ENTITY => AnDatabase :: FETCH_ARRAY , AnDomain :: FETCH_ENTITY_SET => AnDatabase :: FETCH_ARRAY_LIST , AnDomain :: FETCH_ENTITY_LIST => AnDatabase :: FETCH_ARRAY_LIST , AnDomain :: FETCH_VALUE => AnDatabase :: FETCH_FIELD , AnDomain :: FETCH_VALUE_LIST => AnDatabase :: FETCH_FIELD_LIST , ) ; $ mode = $ modes [ $ mode ] ; $ context [ 'data' ] = $ this -> _adapter -> select ( to_str ( $ query ) , $ mode ) ; $ this -> getCommandChain ( ) -> run ( 'after.fetch' , $ context ) ; } return $ context -> data ; }
Fetch a result from a store.

@param AnDomainQuery $query Query object
@param int           $mode  Fetch Mode

@return mixed
Fetch a result from a store .