Example #1
0
File: Lists.php Project: kotow/work
 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         // update list cache
         Lists::deleteListCache($this->getListId());
         Lists::updateListCache($this->getListId());
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #2
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);
         // update list cache
         if (get_class($parent) == "Lists") {
             Lists::updateListCache($parent->getListId());
         }
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }