This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseForm extends sfFormSymfony | |
{ | |
static protected $user = null; | |
static public function getUser() | |
{ | |
return self::$user; | |
} | |
static public function getValidUser() | |
{ | |
if (!self::$user instanceof sfGuardSecurityUser) | |
{ | |
throw new RuntimeException('No valid user instance available'); | |
} | |
return self::$user; | |
} | |
static public function setUser(sfGuardSecurityUser $user) | |
{ | |
self::$user = $user; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class OrdinativiHealthStateForm extends BaseOrdinativiHealthStateForm | |
{ | |
public function configure() | |
{ | |
$this->useFields(array('name')); | |
$this->widgetSchema->setLabels(array( | |
'name' => 'Nome', | |
)); | |
} | |
protected function doSave($con = null) | |
{ | |
$user = self::getValidUser(); | |
if (is_null($con)) | |
{ | |
$con = $this->getConnection(); | |
} | |
$this->updateObject(array('user_id'=>$user->getGuardUser()->getId(), 'name'=>'prova, verrà sostituita dal campo del form')); | |
$this->object->save($con); | |
$this->saveEmbeddedForms($con); | |
return parent::doSave($con); | |
} | |
public function updateObject($values = null) | |
{ | |
$object = parent::updateObject($values); | |
return $object; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment