/** * Populate __sleep values, restore serialize values specified on __sleep() method * * @return self */ public function populateWithItself(self $formulary) { $this->_name = $formulary->getName(); $this->_isActive = $formulary->isActive(); $this->_isDefault = $formulary->isDefault(); return $this; }
public function processDeleteAction() { $tableName = preg_replace('/[^a-zA-Z]+/', '', $this->_getParam("id", "")); if (strlen($tableName) == 0) { $msg = __("Invalid formulary name"); $code = 400; // invalid entry } else { $formulary = new FormularyItem($tableName); if ($formulary->populate(false)) { if ($formulary->isDefault()) { $msg = __("Formulary " . $formulary->getPrettyName() . " is default and cannot be deleted"); $code = 402; } else { $formulary->setPersistMode(WebVista_Model_ORM::DELETE); $formulary->persist(false); $msg = __("Formulary " . $formulary->getPrettyName() . " deleted successfully"); $code = 200; } } else { $msg = __("Formulary " . $formulary->getPrettyName() . " does not exists"); $code = 401; } } $data['msg'] = $msg; $data['code'] = $code; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }