本文整理匯總了PHP中Members::findByObjectId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Members::findByObjectId方法的具體用法?PHP Members::findByObjectId怎麽用?PHP Members::findByObjectId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Members
的用法示例。
在下文中一共展示了Members::findByObjectId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: core_dimensions_after_update
/**
* @author Ignacio Vazquez - elpepe.uy at gmail.com
* @param unknown_type $object
* @param unknown_type $ignored
*/
function core_dimensions_after_update($object, &$ignored)
{
static $objectsProcessed = array();
if ($object instanceof Contact && !array_var($objectsProcessed, $object->getId())) {
$person_dim = Dimensions::findOne(array("conditions" => "`code` = 'feng_persons'"));
$person_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'person'"));
$company_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'company'"));
$members = Members::findByObjectId($object->getId(), $person_dim->getId());
if (count($members) == 1) {
/* @var $member Member */
$member = $members[0];
$member->setName($object->getObjectName());
$parent_member_id = $member->getParentMemberId();
$depth = $member->getDepth();
if ($object->getCompanyId() > 0) {
$pmember = Members::findOne(array('conditions' => '`object_id` = ' . $object->getCompanyId() . ' AND `object_type_id` = ' . $company_ot->getId() . ' AND `dimension_id` = ' . $person_dim->getId()));
$member->setParentMemberId($pmember->getId());
$member->setDepth($pmember->getDepth() + 1);
} else {
//Is first level
$member->setDepth(1);
$member->setParentMemberId(0);
}
$object->modifyMemberValidations($member);
$member->save();
// reload only if not disabling or enabling user
if (!(array_var($_REQUEST, 'c') == 'account' && (array_var($_REQUEST, 'a') == 'disable' || array_var($_REQUEST, 'a') == 'restore_user'))) {
evt_add("reload dimension tree", $member->getDimensionId());
}
$objectsProcessed[$object->getId()] = true;
}
}
}
示例2: modifyMemberValidations
function modifyMemberValidations($member)
{
if ($member instanceof Member) {
$member->add_skip_validation('uniqueness of parent - name');
} else {
if ($this->getId() > 0 && Plugins::instance()->isActivePlugin('core_dimensions')) {
$dim = Dimensions::findByCode('feng_persons');
if ($dim instanceof Dimension) {
$m = Members::findByObjectId($this->getId(), $dim->getId());
if ($m instanceof Member) {
$m->add_skip_validation('uniqueness of parent - name');
}
}
}
}
}