public function queue(CommandInterface $command, array $options = [])
    {
        $queueName = null;

        if (array_key_exists(self::QUEUE_OPTION_NAME, $options)) {
            $queueName = $options[self::QUEUE_OPTION_NAME] ?: null;
            unset($options[self::QUEUE_OPTION_NAME]);
        }

	    $queue = $this->getQueue($queueName);

	    if ($command->getIdentity()) {
	        $identity = $command->getIdentity();
	    } else if ($this->getDefaultIdentity()) {
	        $identity = $this->getDefaultIdentity();
	    } else {
	        $identity = null;
	    }

	    if (method_exists($identity, 'toArray')) {
	        $identity = $identity->toArray();
	    } else if ($identity instanceof \ArrayObject) {
	        $identity = $identity->getArrayCopy();
	    }

	    $job = new ServiceJob();
	    $job->setup($command, $identity);
	    $job->setServiceBroker($this);

	    $queue->push($job, $options);
	    return $job;
	}
public function queue(CommandInterface $command, array $options = [])
    {
        $queueName = null;

        if (array_key_exists(self::QUEUE_OPTION_NAME, $options)) {
            $queueName = $options[self::QUEUE_OPTION_NAME] ?: null;
            unset($options[self::QUEUE_OPTION_NAME]);
        }

	    $queue = $this->getQueue($queueName);

	    if ($command->getIdentity()) {
	        $identity = $command->getIdentity();
	    } else if ($this->getDefaultIdentity()) {
	        $identity = $this->getDefaultIdentity();
	    } else {
	        $identity = null;
	    }

	    if (method_exists($identity, 'toArray')) {
	        $identity = $identity->toArray();
	    } else if ($identity instanceof \ArrayObject) {
	        $identity = $identity->getArrayCopy();
	    }

	    $job = new ServiceJob();
	    $job->setup($command, $identity);
	    $job->setServiceBroker($this);

	    $queue->push($job, $options);
	    return $job;
	}
public function queue ( CommandInterface $ command , array $ options = [ ] ) { $ queueName = null ; if ( array_key_exists ( self :: QUEUE_OPTION_NAME , $ options ) ) { $ queueName = $ options [ self :: QUEUE_OPTION_NAME ] ? : null ; unset ( $ options [ self :: QUEUE_OPTION_NAME ] ) ; } $ queue = $ this -> getQueue ( $ queueName ) ; if ( $ command -> getIdentity ( ) ) { $ identity = $ command -> getIdentity ( ) ; } else if ( $ this -> getDefaultIdentity ( ) ) { $ identity = $ this -> getDefaultIdentity ( ) ; } else { $ identity = null ; } if ( method_exists ( $ identity , 'toArray' ) ) { $ identity = $ identity -> toArray ( ) ; } else if ( $ identity instanceof \ ArrayObject ) { $ identity = $ identity -> getArrayCopy ( ) ; } $ job = new ServiceJob ( ) ; $ job -> setup ( $ command , $ identity ) ; $ job -> setServiceBroker ( $ this ) ; $ queue -> push ( $ job , $ options ) ; return $ job ; }
Queue execution of service operation

@param CommandInterface $command
@param array $options
@return ServiceJob
Queue execution of service operation