9
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
11
class agFooActions extends sfActions
13
public function executeIndex(sfWebRequest $request)
15
$this->ag_foos = Doctrine_Core::getTable('agFoo')
20
public function executeShow(sfWebRequest $request)
22
$this->ag_foo = Doctrine_Core::getTable('agFoo')->find(array($request->getParameter('id')));
23
$this->forward404Unless($this->ag_foo);
26
public function executeNew(sfWebRequest $request)
28
$this->form = new agFooForm();
31
public function executeCreate(sfWebRequest $request)
33
$this->forward404Unless($request->isMethod(sfRequest::POST));
35
$this->form = new agFooForm();
37
$this->processForm($request, $this->form);
39
$this->setTemplate('new');
42
public function executeEdit(sfWebRequest $request)
44
$this->forward404Unless($ag_foo = Doctrine_Core::getTable('agFoo')->find(array($request->getParameter('id'))), sprintf('Object ag_foo does not exist (%s).', $request->getParameter('id')));
45
$this->form = new agFooForm($ag_foo);
48
public function executeUpdate(sfWebRequest $request)
50
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
51
$this->forward404Unless($ag_foo = Doctrine_Core::getTable('agFoo')->find(array($request->getParameter('id'))), sprintf('Object ag_foo does not exist (%s).', $request->getParameter('id')));
52
$this->form = new agFooForm($ag_foo);
54
$this->processForm($request, $this->form);
56
$this->setTemplate('edit');
59
public function executeDelete(sfWebRequest $request)
61
$request->checkCSRFProtection();
63
$this->forward404Unless($ag_foo = Doctrine_Core::getTable('agFoo')->find(array($request->getParameter('id'))), sprintf('Object ag_foo does not exist (%s).', $request->getParameter('id')));
66
$this->redirect('foo/index');
69
protected function processForm(sfWebRequest $request, sfForm $form)
71
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
74
$ag_foo = $form->save();
76
$this->redirect('foo/edit?id='.$ag_foo->getId());