public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($card = CardPeer::retrieveByPk($request->getParameter('id')), sprintf('Object card does not exist (%s).', $request->getParameter('id'))); $card->delete(); $this->redirect('card/index'); }
public function executeCreate(sfWebRequest $request) { $this->forward404Unless($request->isMethod('post')); if ($request->hasParameter('userId')) { $this->forward404Unless($this->user = UserPeer::retrieveByPk($request->getParameter('userId')), sprintf('Object user does not exist (%s).', $request->getParameter('userId'))); $this->form = new SubscriptionForm(); $this->processForm($request, $this->form); $this->form->setDefaultUser($this->user); } elseif ($request->hasParameter('cardId')) { $this->forward404Unless($this->card = CardPeer::retrieveByPk($request->getParameter('cardId')), sprintf('Object card does not exist (%s).', $request->getParameter('cardId'))); $this->form = new SubscriptionForm(); $this->processForm($request, $this->form); $this->form->setDefaultCard($this->card); } else { $this->forward404('No user or card specified.'); } $this->setTemplate('new'); }