I am making my first extension, to test some extension development features.
I was trying send data from a view to one controller. I can get thsi using Get and LamedParameters in the path. But When I try make this using post never read my params. I will try show you my problem (I hope you can help me with this)
I make a POST request like this:
Code: Select all
http://localhost:8000/app.php/genaut/translate
Request Method: POST
Request Payload: {"text":"This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board.","lang_target":"es"}
Code: Select all
genaut_posttranslator_route:
path: /genaut/translate
defaults: { _controller: genaut.posttranslator.controller.translator_controller:translate}
methods: [POST]
Code: Select all
public function translate($text, $lang_target)
{
$translation_response = $text;
if(empty($text) || empty($lang_target)){
$translation_response = 'Cant\'t translate (Not received info). Original text:' . $text;
}
}
Code: Select all
{
message : "Falta el valor para el argumento #1: <strong>text</strong> en la clase <strong>genaut\\posttranslator\\controller\\translator_controller:translate</strong>"
}
Code: Select all
genaut_posttranslator_route:
path: /genaut/translate/{text}/{lang_target}
defaults: { _controller: genaut.posttranslator.controller.translator_controller:translate}