本文整理汇总了PHP中ApplicationLogs::setIsPrivateForObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationLogs::setIsPrivateForObject方法的具体用法?PHP ApplicationLogs::setIsPrivateForObject怎么用?PHP ApplicationLogs::setIsPrivateForObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationLogs
的用法示例。
在下文中一共展示了ApplicationLogs::setIsPrivateForObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createLog
/**
* Create new log entry and return it
*
* Delete actions are automaticly marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationLog
*/
static function createLog(ApplicationDataObject $object, $project, $action = null, $is_private = false, $is_silent = null, $save = true)
{
if (is_null($action)) {
$action = self::ACTION_ADD;
}
// if
if (!self::isValidAction($action)) {
throw new Error("'{$action}' is not valid log action");
}
// if
if (is_null($is_silent)) {
$is_silent = $action == self::ACTION_DELETE;
} else {
$is_silent = (bool) $is_silent;
}
// if
$manager = $object->manager();
if (!$manager instanceof DataManager) {
throw new Error('Invalid object manager');
}
// if
$log = new ApplicationLog();
if ($project instanceof Project) {
$log->setProjectId($project->getId());
}
// if
$log->setTakenById(logged_user()->getId());
$log->setRelObjectId($object->getObjectId());
$log->setObjectName($object->getObjectName());
$log->setRelObjectManager(get_class($manager));
$log->setAction($action);
$log->setIsPrivate($is_private);
$log->setIsSilent($is_silent);
if ($save) {
$log->save();
}
// if
// Update is private for this object
if ($object instanceof ProjectDataObject) {
ApplicationLogs::setIsPrivateForObject($object);
}
// if
return $log;
}