我想在我的 Symfony 操作中设置一个变量,以保存该操作的渲染模板数据。我正在返回一些带有动作的 JSON 内容,我想将动作输出的内容存储到 JSON 中并将其返回。
public function executeAjaxPriceAdditionCreate(sfWebRequest $request)
{
$this->form = new ProductPriceAdditionAjaxForm();
$json['success'] = $this->processAjaxPriceAdditionForm($request, $this->form);
$this->setTemplate('ajaxPriceAdditionNew');
$json['content'] = ???; // THIS IS WHERE THE RENDERED TEMPLATE CONTENT SHOULD GO.
$this->getResponse()->setHttpHeader('Content-Type','application/json; charset=utf-8');
return $this->renderText(json_encode($json));
}