Example #1
0
File: Tag.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();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #2
0
 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $genDoc = Document::getGenericDocument($this);
             $genDoc->setPublicationStatus("WAITING");
             $genDoc->save();
             $this->setId($genDoc->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));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #3
0
 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));
         // get Lists object
         if (!$parent) {
             $parent = Document::getParentOf($this->getId());
         }
         // update list cache
         if (get_class($parent) == "Lists") {
             Lists::updateListCache($parent->getListId());
         }
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #4
0
File: User.php Project: kotow/work
 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (trim($this->__toString()) != "") {
             $this->setLabel($this->__toString());
         }
         switch ($this->getType()) {
             case "admin":
                 //case "site_admin":
                 $this->setBackend(1);
                 break;
             default:
                 $this->setBackend(0);
         }
         if ($this->getLogin() == "") {
             $this->setLogin($this->getEmail());
         }
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         /*if (!$this->getPublicationStatus())
         		{
         			$this->setPublicationStatus(UtilsHelper::STATUS_ACTIVE);
         		}*/
         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));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #5
0
File: Media.php Project: kotow/work
 public function save($con = null, $parent = null, $refreshTree = true)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         $genericDoc = Document::getGenericDocument($this);
         if (!$this->getId()) {
             $this->setId($genericDoc->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent) {
             $parent = Document::getParentOf($this->getId(), null, true, false);
             if (empty($parent)) {
                 $parent = Rootfolder::getRootfolder($this);
             }
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, "Media", $refreshTree);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }