当前位置: 首页>>代码示例>>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;未经允许,请勿转载。