src/Facades/QueryBus.php
public static function resultFrom($aQuery)
    {
        /** @var \Prooph\ServiceBus\QueryBus $instance */
        $instance = self::getFacadeRoot();
        $ret = null;

        $instance
            ->dispatch($aQuery)
            ->done(function ($result) use (&$ret) {
                $ret = $result;
            }, function () use ($aQuery) {
                throw QueryResultFailed::fromQuery($aQuery, func_get_args());
            });

        return $ret;
    }
public static function resultFrom($aQuery)
    {
        /** @var \Prooph\ServiceBus\QueryBus $instance */
        $instance = self::getFacadeRoot();
        $ret = null;

        $instance
            ->dispatch($aQuery)
            ->done(function ($result) use (&$ret) {
                $ret = $result;
            }, function () use ($aQuery) {
                throw QueryResultFailed::fromQuery($aQuery, func_get_args());
            });

        return $ret;
    }
public static function resultFrom ( $ aQuery ) { /** @var \Prooph\ServiceBus\QueryBus $instance */ $ instance = self :: getFacadeRoot ( ) ; $ ret = null ; $ instance -> dispatch ( $ aQuery ) -> done ( function ( $ result ) use ( & $ ret ) { $ ret = $ result ; } , function ( ) use ( $ aQuery ) { throw QueryResultFailed :: fromQuery ( $ aQuery , func_get_args ( ) ) ; } ) ; return $ ret ; }
The default dispatch method will return you a promise
sometimes you might want to just get the result instead
this method will return you the result on a successful
query, and throw an exception instead if the query
fails.

@throws QueryResultFailed
@param Query|mixed $aQuery
@return mixed
The default dispatch method will return you a promise sometimes you might want to just get the result instead this method will return you the result on a successful query and throw an exception instead if the query fails .