I'm still fairly new to symfony, so my apologies if this is a stupid question. I'm using symfony 1.4 with Doctrine. My colleague wrote a JavaScript to make a report from our client side widget to our server:
$j.post(serverpath, {widget_id:widget_id, user_id:user_id, object_id:object_id, action_type:action_type, text_value:stuff_to_report });
I created a route in routing.yml to receive this request:
widget_report:
url: /widget/report/
options: {model: ReportClass, type: object }
param: {module: widget, action: reports}
requirements:
object_id: \d+
user_id: \d+
action_type: \d+
sf_method: [post]
I created an action in actions.class.php to handle the request:
public function executeReports(sfWebRequest $request) {
foreach($request->getParameterHolder()->getAll() as $param => $val) {
// $param is the query string name, $val is its value
$this->logMessage("executeReports: $param is $val");
}
try {
[...]
$actionHistory->setUserId($request->getParameter('user_id', 1));
$this->logMessage("executeReports success: ");
} catch {
[...]
}
}
My log file reports:
Jul 20 18:51:35 symfony [info] {widgetActions} Call "widgetActions->executeReports()"
Jul 20 18:51:35 symfony [info] {widgetActions} executeReports: module is widget
Jul 20 18:51:35 symfony [info] {widgetActions} executeReports: action is reports
Jul 20 18:51:35 symfony [info] {widgetActions} executeReports success:
I must be missing a step here. We had this working when passing the variables in the URL (and specifying the variables in the route, of course), but for various reasons we want to use POST instead.
Why are my POST parameters not accessible in actions.class.php?