, 난 형태로 URL 매개 변수에 포함 된 값을 설정할Symfony : executeNew()와 executeCreate() 사이에 변수를 전달하는 방법은 무엇입니까? 심포니/교리에서
offer/registration/new?offer_id=23
public function executeNew(sfWebRequest $request)
{
// echo $request->gerParameter('offer_id');
// echoes 23
$this->form = $this->configuration->getForm();
$this->offer_registration = $this->form->getObject();
}
public function executeCreate(sfWebRequest $request)
{
// echo $request->gerParameter('offer_id');
// echoes nothing
$offer = new OfferRegistration();
$offer->setOfferId($offer_id);
$this->form = $this->configuration->getForm($offer);
$this->offer_registration = $this->form->getObject();
$this->processForm($request, $this->form);
$this->setTemplate('new');
}
executeNew()와 executeCreate() 내가 권한을 설정할 수 있도록 사이의 $ OFFER_ID를 전달하는 방법 양식 상에 제공 되었습니까?
PS : 나는 관리자 백엔드 모듈 NEW 링크를 클릭 할 때 매개 변수를 전달해야
감사합니다 Jon ;-) –
제 경우에는 * i 추측 * : php $ helper-> linkToSave ($ form-> getObject(), array ('params'=> array ($ offer_id => $ request-> getParameter ('offer_id')), 'class_suffix'=> '저장', '레이블'=> '저장'))? 내가 맞습니까? –
아니오 - 템플릿에서 $ request 객체를 사용할 수 없습니다. 당신은 어떤 ID를 당신의 행동에 전달할 것인지를 결정할 필요가 있습니다. 다음과 같이 배열에 있어야합니다 : $ offer_id => $ idVariable --- 새로운 링크가 인덱스에 나타나기 때문에 executeIndex 액션 ($ this-> idVariable = $ foo)에서 변수를 설정할 수 있습니다. – jgallant