/** * Delete a license. All revisions that pointed to this license will now * have their license set to null. * * @param LicenseDao $licenseDao license DAO * @return true on success * @throws Zend_Exception */ public function delete($licenseDao) { if (!$licenseDao instanceof LicenseDao) { throw new Zend_Exception('Must be a license DAO'); } if (!$licenseDao->saved) { throw new Zend_Exception('DAO must be saved'); } // Replace references to this license with null values $this->database->getDB()->update('itemrevision', array('license_id' => null), array('license_id = ?' => $licenseDao->getKey())); parent::delete($licenseDao); unset($licenseDao->license_id); $licenseDao->saved = false; return true; }
/** Create a new license */ public function createAction() { $this->requireAdminPrivileges(); $this->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $name = $this->getParam('name'); $fulltext = $this->getParam('fulltext'); $license = new LicenseDao(); $license->setName($name); $license->setFulltext($fulltext); $this->License->save($license); echo JsonComponent::encode(array(true, 'Created new license')); }