當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Objects::findById方法代碼示例

本文整理匯總了PHP中Objects::findById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Objects::findById方法的具體用法?PHP Objects::findById怎麽用?PHP Objects::findById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Objects的用法示例。


在下文中一共展示了Objects::findById方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findById

 function findById($id, $force_reload = false)
 {
     $co = parent::findById($id, $force_reload);
     if (!is_null($co)) {
         $co->setObject(Objects::findById($id, $force_reload));
     }
     return $co;
 }
開發者ID:abhinay100,項目名稱:feng_app,代碼行數:8,代碼來源:ContentDataObjects.class.php

示例2: delete

	function delete($check = true) {
		if ($check && !$this->canBeDeleted($error_message)) {
			throw new Exception($error_message);
		}
		// change parent of child nodes
		$child_members = $this->getAllChildren();
		if (is_array($child_members)) {
			$parent = $this->getParentMember();
			foreach($child_members as $child) {
				$child->setParentMemberId($this->getParentMemberId());
				if ($parent instanceof Member) {
					$child->setDepth($parent->getDepth()+1);
				} else $child->setDepth(1);
				$child->save();
			}
		}
		
		// delete member restrictions
		MemberRestrictions::delete(array("`member_id` = ?", $this->getId()));
		MemberRestrictions::delete(array("`restricted_member_id` = ?", $this->getId()));
		
		// delete member properties
		MemberPropertyMembers::delete(array("`member_id` = ?", $this->getId()));
		MemberPropertyMembers::delete(array("`property_member_id` = ?", $this->getId()));
		
		// delete permissions
		ContactMemberPermissions::delete(array("member_id = ?", $this->getId()));
		
		// delete member objects (if they don't belong to another member)
		$sql = "SELECT `o`.`object_id` FROM `".ObjectMembers::instance()->getTableName()."` `o` WHERE `o`.`is_optimization`=0 AND `o`.`member_id`=".$this->getId()." AND NOT EXISTS (
			SELECT `om`.`object_id` FROM `".ObjectMembers::instance()->getTableName()."` `om` WHERE `om`.`object_id`=`o`.`object_id` AND `om`.`is_optimization`=0 AND `om`.`member_id`<>".$this->getId().")";
		$result = DB::execute($sql);
    	$rows = $result->fetchAll();
    	if (!is_null($rows)) {
	    	foreach ($rows as $row) {
	    		$obj = Objects::findById(array_var($row, 'object_id'));
	    		$obj->delete();
	    	}
    	}
    	
    	// clean object_members
    	ObjectMembers::delete("member_id = ".$this->getId());
		
		// delete object if member is a dimension_object
		if ($this->getObjectId()) {
			$object = Objects::findObject($this->getObjectId());
			if ($object instanceof ContentDataObject) $object->delete();
		}
		
		ApplicationLogs::createLog($this, ApplicationLogs::ACTION_DELETE, false, true, true, 'member deleted');
		
		return parent::delete();
	}
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:53,代碼來源:Member.class.php

示例3: delete

 function delete()
 {
     // change parent of child nodes
     $child_members = $this->getAllChildren();
     if (is_array($child_members)) {
         $parent = $this->getParentMember();
         foreach ($child_members as $child) {
             $child->setParentMemberId($this->getParentMemberId());
             if ($parent instanceof Member) {
                 $child->setDepth($parent->getDepth() + 1);
             } else {
                 $child->setDepth(1);
             }
             $child->save();
         }
     }
     // delete member restrictions
     MemberRestrictions::delete(array("`member_id` = ?", $this->getId()));
     MemberRestrictions::delete(array("`restricted_member_id` = ?", $this->getId()));
     // delete member properties
     MemberPropertyMembers::delete(array("`member_id` = ?", $this->getId()));
     MemberPropertyMembers::delete(array("`property_member_id` = ?", $this->getId()));
     // delete permissions
     ContactMemberPermissions::delete(array("member_id = ?", $this->getId()));
     // delete member objects (if they don't belong to another member)
     $sql = "SELECT `o`.`object_id` FROM `" . ObjectMembers::instance()->getTableName() . "` `o` WHERE `o`.`is_optimization`=0 AND `o`.`member_id`=" . $this->getId() . " AND NOT EXISTS (\n\t\t\tSELECT `om`.`object_id` FROM `" . ObjectMembers::instance()->getTableName() . "` `om` WHERE `om`.`object_id`=`o`.`object_id` AND `om`.`is_optimization`=0 AND `om`.`member_id`<>" . $this->getId() . ")";
     $result = DB::execute($sql);
     $rows = $result->fetchAll();
     if (!is_null($rows)) {
         foreach ($rows as $row) {
             $obj = Objects::findById(array_var($row, 'object_id'));
             $obj->delete();
         }
     }
     // delete object if member is a dimension_object
     if ($this->getObjectId()) {
         $object = Objects::findObject($this->getObjectId());
         if ($object instanceof ContentDataObject) {
             $object->delete();
         }
     }
     return parent::delete();
 }
開發者ID:rorteg,項目名稱:fengoffice,代碼行數:43,代碼來源:Member.class.php

示例4: findById

 function findById($id)
 {
     $co = parent::findById($id);
     if (!is_null($co)) {
         $co->setObject(Objects::findById($id));
     }
     return $co;
 }
開發者ID:rorteg,項目名稱:fengoffice,代碼行數:8,代碼來源:ContentDataObjects.class.php


注:本文中的Objects::findById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。