function removeContent($ConCategory, $ConParent, $ConId) { try { $c = new Criteria(); $c->add(ContentPeer::CON_CATEGORY, $ConCategory); $c->add(ContentPeer::CON_PARENT, $ConParent); $c->add(ContentPeer::CON_ID, $ConId); $result = ContentPeer::doSelectRS($c); $result->next(); $row = $result->getRow(); while (is_array($row)) { ContentPeer::doDelete(array($ConCategory, $ConParent, $ConId, $row[3])); $result->next(); $row = $result->getRow(); } } catch (Exception $e) { throw $e; } }
/** * Removes this object from datastore and sets delete attribute. * * @param Connection $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete($con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(ContentPeer::DATABASE_NAME); } try { $con->begin(); ContentPeer::doDelete($this, $con); $this->setDeleted(true); $con->commit(); } catch (PropelException $e) { $con->rollback(); throw $e; } }
$oDataset->next(); $aRow1 = $oDataset->getRow(); if (is_array($aRow1)) { $G_PUBLISH = new Publisher(); $G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'SETUP'; $G_SUB_MENU = 'setup'; $G_ID_SUB_MENU_SELECTED = 'LANGUAGES'; //$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use"; //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage ); //G::RenderPage('publishBlank', 'blank'); G::SendTemporalMessage('CANT_DEL_LANGUAGE', 'error', 'labels'); G::header('location: languages'); } else { /*the reason why comment it was because when delete some language,we're losing some labels about this language*/ $oCriteria = new Criteria('workflow'); $oCriteria->add(ContentPeer::CON_LANG, $_GET['LAN_ID']); ContentPeer::doDelete($oCriteria); /* $oCriteria1 = new Criteria('workflow'); $oCriteria1->add(LanguagePeer::LAN_ENABLED, 0); $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']); LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow')); */ $aLanguage['LAN_ID'] = $_GET['LAN_ID']; $aLanguage['LAN_ENABLED'] = 0; $oLanguage = new Language(); $oLanguage->update($aLanguage); G::header('Location: languages'); }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $ret = $this->preDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseContent:delete:pre') as $callable) { if ($ret = call_user_func($callable, $this, $con)) { return; } } if ($ret) { ContentPeer::doDelete($this, $con); $this->postDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseContent:delete:post') as $callable) { call_user_func($callable, $this, $con); } $this->setDeleted(true); $con->commit(); } else { $con->commit(); } } catch (PropelException $e) { $con->rollBack(); throw $e; } }