Hello everyone.
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:I have this routing config (Route without parameters because in Post method are not neccessary):In my controller "translate" method, I have this:I am getting this error:Before, I tested with a GET configuration like this (or something like this) and worked fine:So I think that I am missing something in the routing. I tried too using request class to get the post variables using "is_set_post" and ohter functions but nothing retrieve me data. Any idea?
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:
http://localhost:8000/app.php/genaut/translateRequest Method: POSTRequest 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:
genaut_posttranslator_route: path: /genaut/translate defaults: { _controller: genaut.posttranslator.controller.translator_controller:translate} methods: [POST]
Code:
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:
{message : "Falta el valor para el argumento #1: <strong>text</strong> en la clase <strong>genaut\\posttranslator\\controller\\translator_controller:translate</strong>"}
Code:
genaut_posttranslator_route: path: /genaut/translate/{text}/{lang_target} defaults: { _controller: genaut.posttranslator.controller.translator_controller:translate}
Statistics: Posted by Juanla — Mon Apr 01, 2024 12:33 am