本文整理汇总了PHP中Relation::saveRelation方法的典型用法代码示例。如果您正苦于以下问题:PHP Relation::saveRelation方法的具体用法?PHP Relation::saveRelation怎么用?PHP Relation::saveRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relation
的用法示例。
在下文中一共展示了Relation::saveRelation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
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;
}
}
示例2: save
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;
}
}
示例3: save
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;
}
}
示例4: save
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;
}
}
示例5: save
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;
}
}