0

我正在尝试从树枝中呈现一个动作以列出表格的结果。第一个变量通过正常,我正在填充列表,但第二个变量没有到达。

{% render 'RiskAssessmentBundle:Assessment:assessmentlist' with {'offenderId': entity.getId, 'assessmentStatus': 'Complete' } %}

以上是我的树枝模板中的渲染调用。offenderId 带着一个值到达。

    /**
 * List widget
 *
 * @param int $offenderId   id of the offender
 * @param string $assessmentStatus   const value of desired status
 *
 * @Template("RiskAssessmentBundle:Assessment:assessmentlist.html.twig")
 */
public function assessmentlistAction($offenderId, $assessmentStatus = null)
{
    var_dump($assessmentStatus);
    $em = $this->getDoctrine()->getEntityManager();

    $offender = $em->getRepository('RiskOffenderBundle:Offender')->find($offenderId);

    if (is_null($assessmentStatus)) {
        $assessments = $em->getRepository('RiskAssessmentBundle:Assessment')
            ->findAllByActive(true, $offenderId, 5);
    } else {
        $assessments = $em->getRepository('RiskAssessmentBundle:Assessment')
            ->findAllByStatus($assessmentStatus, $offenderId, 5);
    }

    return array(
        'assessments' => $assessments,
        'offender' => $offender,
    );
}

以上是调用的动作。$assessmentStatus 的 var_dump 始终为 NULL。我是 symfony 的新手,但是我能找到的每一个文档都让我觉得这应该可以工作。任何人都知道我做错了什么?

4

1 回答 1

0

The above code works perfectly. We have an extension system running and the entire twig template had been extended. The render I modified was not the render being called. Once I modified the other template it all works perfectly.

于 2012-11-09T13:17:38.600 回答