public function addHandlerDefinition($commandClassName, $handlerServiceId)
    {
        // Check if handler already associated with command
        if (isset($this->handlerDefinitions[$commandClassName])) {
            throw new \InvalidArgumentException(sprintf(
                "Handler with service id '%s' already configured for command %s'",
                $this->handlerDefinitions[$commandClassName]['handler'],
                $commandClassName
            ));
        }

        // Add handler definition
        $this->handlerDefinitions[$commandClassName] = [
            'handler' => $handlerServiceId,
        ];

        return $this;
    }
public function addHandlerDefinition($commandClassName, $handlerServiceId)
    {
        // Check if handler already associated with command
        if (isset($this->handlerDefinitions[$commandClassName])) {
            throw new \InvalidArgumentException(sprintf(
                "Handler with service id '%s' already configured for command %s'",
                $this->handlerDefinitions[$commandClassName]['handler'],
                $commandClassName
            ));
        }

        // Add handler definition
        $this->handlerDefinitions[$commandClassName] = [
            'handler' => $handlerServiceId,
        ];

        return $this;
    }
public function addHandlerDefinition ( $ commandClassName , $ handlerServiceId ) { // Check if handler already associated with command if ( isset ( $ this -> handlerDefinitions [ $ commandClassName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "Handler with service id '%s' already configured for command %s'" , $ this -> handlerDefinitions [ $ commandClassName ] [ 'handler' ] , $ commandClassName ) ) ; } // Add handler definition $ this -> handlerDefinitions [ $ commandClassName ] = [ 'handler' => $ handlerServiceId , ] ; return $ this ; }
Add handler definition
@param string $commandClassName
@param string $handlerServiceId
@return CommandBus
Add handler definition