Это (часть) определения BaseOperation
с одним обязательным параметром (foo
):
'BaseOperation' => array(
'class' => 'My\Command\MyCustomCommand',
'httpMethod' => 'POST',
'parameters' => array(
'foo' => array(
'required' => true,
'location' => 'query'
)
)
)
Внутри плагина ChangeMethodPlugin
мне нужно изменить значение foo
во время выполнения:
class ChangeMethodPlugin implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array('command.before_send' => 'onBeforeCommandSend');
}
public function onBeforeCommandSend(Event $event)
{
/** @var \Guzzle\Service\Command\CommandInterface $command */
$command = $event['command'];
// Only if test configuration is true
if ($command->getClient()->getConfig(ClientOptions::TEST)) {
// Only if command is MyCustomCommand
if ($command instanceof MyCustomCommand) {
// Here I need to change the value of 'foo' parameter
}
}
}
}
Я не могу найти какой-либо метод внутри Parameter
a> или AbstractCommand
.
EDIT: имя параметра изменено на "foo" с "method", чтобы избежать путаницы с HTTP-глаголами.