コード例 #1
0
ファイル: QueryMemoryMap.php プロジェクト: novuso/common-l
 /**
  * Retrieves a handler by query class name
  *
  * @param string $queryClass The full query class name
  *
  * @return QueryHandler
  *
  * @throws HandlerNotFoundException When the handler is not found
  */
 public function getHandler($queryClass)
 {
     $type = Type::create($queryClass)->toString();
     if (!isset($this->handlers[$type])) {
         $message = sprintf('Handler not defined for query: %s', $queryClass);
         throw HandlerNotFoundException::create($message);
     }
     return $this->handlers[$type];
 }
コード例 #2
0
ファイル: QueryServiceMap.php プロジェクト: novuso/common-l
 /**
  * Retrieves a handler by query class name
  *
  * @param string $queryClass The full query class name
  *
  * @return QueryHandler
  *
  * @throws HandlerNotFoundException When the handler is not found
  */
 public function getHandler($queryClass)
 {
     $type = Type::create($queryClass)->toString();
     if (!isset($this->handlers[$type])) {
         $message = sprintf('Handler not defined for query: %s', $queryClass);
         throw HandlerNotFoundException::create($message);
     }
     $serviceId = $this->handlers[$type];
     try {
         $handler = $this->container->get($serviceId);
     } catch (ServiceContainerException $exception) {
         throw HandlerNotFoundException::create($exception->getMessage(), $exception);
     }
     return $handler;
 }
コード例 #3
0
 public function test_that_create_returns_exception_instance()
 {
     $exception = HandlerNotFoundException::create('Handler not found');
     $this->assertInstanceOf('Novuso\\Common\\Application\\Messaging\\Query\\Exception\\HandlerNotFoundException', $exception);
 }