$ id 등록 정보 및 getId() 메소드가있는 질문 클래스가 있습니다. 나는 또한 그 질문에 대한 답변의 수를 표시하고자하는 컨트롤러에 인덱스 액션을 가지고있다. 내 indexSuccess 템플릿에서조치의 메소드 호출
class questionActions extends sfActions
{
public function executeIndex(sfWebRequest $request)
{
$q_id = $this->getQuestion()->getId();
$this->answers = Doctrine_Core::getTable('answer')
->createQuery('u')
->where('u.question_id = ?', $q_id)
->execute();
}
:
<?php if ($answers) : ?>
<p><?php echo count($answers) ?> answers to this request.</p>
<?php endif; ?>
그러나,이 오류 결과
가 : 정의되지 않은 메서드를 호출합니다.$ q_id 값을 수동으로 할당하면 모든 것이 완벽하게 작동합니다.
조치에서 getId() 메소드 호출을 지정하려면 어떻게해야합니까? 그 호출이 컨트롤러에 있어야할까요?
'getQuestion()'메서드를 볼 수 있습니까? – j0k