Skip to content

Instantly share code, notes, and snippets.

@garak
Forked from delbono/gist:549638
Created August 25, 2010 14:59
Show Gist options
  • Save garak/549660 to your computer and use it in GitHub Desktop.
Save garak/549660 to your computer and use it in GitHub Desktop.
<?php
/**
* healthstate actions.
*
* @package ordinativi
* @subpackage healthstate
* @author KEY5
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class healthstateActions extends sfActions
{
// ...
public function executeCreate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST));
$user = $this->getUser()->getGuardUser();
$this->form = new OrdinativiHealthStateForm(new OrdinativiHealthState(), array('user_id'=>$user->getId()));
$this->processForm($request, $this->form);
$this->setTemplate('new');
}
<?php
/**
* OrdinativiHealthState form.
*
* @package ordinativi
* @subpackage form
* @author Your name here
* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class OrdinativiHealthStateForm extends BaseOrdinativiHealthStateForm
{
public function configure()
{
$this->useFields(array('name'));
$this->widgetSchema->setLabels(array(
'name' => 'Nome',
));
$this->getObject()->setUserId($this->getOption('user_id'));
}
}
@garak
Copy link
Author

garak commented Aug 25, 2010

$this->forward404Unless($request->isMethod(sfRequest::POST)); è superata. Metti piuttosto un requirement nel routing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment