Esempio n. 1
0
 /**
  * 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(WebEntryPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         WebEntryPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
Esempio n. 2
0
 /**
  * Delete Web Entry
  *
  * @param string $webEntryUid Unique id of Web Entry
  *
  * return void
  */
 public function delete($webEntryUid)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]);
         //Set variables
         $arrayWebEntryData = $this->getWebEntry($webEntryUid, true);
         //Delete content
         \Content::removeContent("WE_TITLE", "", $webEntryUid);
         \Content::removeContent("WE_DESCRIPTION", "", $webEntryUid);
         //Delete web entry
         $criteria = new \Criteria("workflow");
         $criteria->add(\WebEntryPeer::WE_UID, $webEntryUid);
         $result = \WebEntryPeer::doDelete($criteria);
         //Delete files
         if ($arrayWebEntryData["WE_METHOD"] == "WS") {
             $pathDataPublicProcess = PATH_DATA_PUBLIC . $arrayWebEntryData["PRO_UID"];
             $fileName = str_replace(".php", "", trim($arrayWebEntryData["WE_DATA"]));
             $file = $pathDataPublicProcess . PATH_SEP . $fileName . ".php";
             if (is_file($file) && file_exists($file)) {
                 unlink($file);
                 unlink($pathDataPublicProcess . PATH_SEP . $fileName . "Post.php");
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }