Beispiel #1
0
 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         $genericDocument->delete();
         //deletes any tags for this document
         $c = new Criteria();
         $c->add(TagrelationPeer::TAG_ID, $this->getId());
         $tagRelations = TagrelationPeer::doSelect($c);
         foreach ($tagRelations as $tag) {
             $tag->delete();
         }
         parent::delete();
         $con->commit();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Beispiel #2
0
 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         Document::getGenericDocument($this)->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Beispiel #3
0
 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         $genericDocument->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         // remove list cache
         Lists::deleteListCache($this->getListId());
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Beispiel #4
0
 public static function deleteDocument($id)
 {
     $con = Propel::getConnection(DocumentPeer::DATABASE_NAME);
     $stmt = $con->createStatement();
     $children = $medias = array();
     $medias = Document::getChildrenOf($id, "Media");
     if ($medias) {
         foreach ($medias as $media) {
             $media->delete();
         }
     }
     $children = Document::getChildrenOf($id, null, false);
     $sql = "DELETE FROM m_document WHERE m_document.id = {$id}";
     $stmt->executeQuery($sql);
     Document::deleteObjCache($id);
     foreach ($children as $child) {
         self::deleteDocument($child);
     }
 }
Beispiel #5
0
 public function delete($con = null)
 {
     $file = $this->getServerAbsoluteUrl();
     $thumb = $this->getServerAbsoluteThumbUrl();
     $filedeleted = true;
     $thumbdeleted = true;
     if (file_exists($file)) {
         $filedeleted = unlink($file);
     }
     if (file_exists($thumb)) {
         $thumbdeleted = unlink($thumb);
     }
     if (!$filedeleted) {
         FileHelper::Log("\tError: file '" . $file . "' could not be deleted!");
     }
     try {
         $con = Propel::getConnection();
         $con->begin();
         //deletes generic document
         $genericDocument = Document::getGenericDocument($this);
         if ($genericDocument) {
             $genericDocument->delete();
         }
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }