本文整理汇总了PHP中Repository::setInferOptionsFromParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::setInferOptionsFromParent方法的具体用法?PHP Repository::setInferOptionsFromParent怎么用?PHP Repository::setInferOptionsFromParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::setInferOptionsFromParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: repoFromDb
/**
* Create a Repository object from a Database Result
*
* The method expects the following schema:
* CREATE TABLE ajxp_repo ( uuid VARCHAR(33) PRIMARY KEY,
* path VARCHAR(255),
* display VARCHAR(255),
* accessType VARCHAR(20),
* recycle VARCHAR(255) ,
* bcreate BOOLEAN, -- For some reason 'create' is a reserved keyword
* writeable BOOLEAN,
* enabled BOOLEAN );
*
* Additionally, the options are stored in a separate table:
* CREATE TABLE ajxp_repo_options ( oid INTEGER PRIMARY KEY, uuid VARCHAR(33), name VARCHAR(50), val VARCHAR(255) );
*
* I recommend an index to increase performance of uuid lookups:
* CREATE INDEX ajxp_repo_options_uuid_idx ON ajxp_repo_options ( uuid );
*
*
* @param $result Result of a dibi::query() as array
* @param array|\Result $options_result Result of dibi::query() for options as array
* @return Repository object
*/
public function repoFromDb($result, $options_result = array())
{
$repo = new Repository($result['id'], $result['display'], $result['accessType']);
$repo->uuid = $result['uuid'];
$repo->setOwnerData($result['parent_uuid'], $result['owner_user_id'], $result['child_user_id']);
$repo->path = $result['path'];
$repo->create = (bool) $result['bcreate'];
$repo->writeable = (bool) $result['writeable'];
$repo->enabled = (bool) $result['enabled'];
$repo->recycle = "";
$repo->setSlug($result['slug']);
if (isset($result['groupPath']) && !empty($result['groupPath'])) {
$repo->setGroupPath($result['groupPath']);
}
$repo->isTemplate = (bool) $result['isTemplate'];
$repo->setInferOptionsFromParent((bool) $result['inferOptionsFromParent']);
foreach ($options_result as $k => $v) {
if (strpos($v, '$phpserial$') !== false && strpos($v, '$phpserial$') === 0) {
$v = unserialize(substr($v, strlen('$phpserial$')));
} else {
if ($k == "META_SOURCES") {
$v = unserialize($v);
}
}
$repo->options[$k] = $v;
}
if (isset($repo->options["content_filter"]) && is_a($repo->options["content_filter"], "ContentFilter")) {
$repo->setContentFilter($repo->options["content_filter"]);
}
return $repo;
}
示例2: repoFromDb
/**
* Create a Repository object from a Database Result
*
* The method expects the following schema:
* CREATE TABLE ajxp_repo ( uuid VARCHAR(33) PRIMARY KEY,
* path VARCHAR(255),
* display VARCHAR(255),
* accessType VARCHAR(20),
* recycle VARCHAR(255) ,
* bcreate BOOLEAN, -- For some reason 'create' is a reserved keyword
* writeable BOOLEAN,
* enabled BOOLEAN );
*
* Additionally, the options are stored in a separate table:
* CREATE TABLE ajxp_repo_options ( oid INTEGER PRIMARY KEY, uuid VARCHAR(33), name VARCHAR(50), val VARCHAR(255) );
*
* I recommend an index to increase performance of uuid lookups:
* CREATE INDEX ajxp_repo_options_uuid_idx ON ajxp_repo_options ( uuid );
*
*
* @param $result Result of a dibi::query() as array
* @param $options_result Result of dibi::query() for options as array
* @return Repository object
*/
function repoFromDb($result, $options_result = array())
{
$repo = new Repository($result['id'], $result['display'], $result['accessType']);
$repo->uuid = $result['uuid'];
$repo->setOwnerData($result['parent_uuid'], $result['owner_user_id'], $result['child_user_id']);
$repo->path = $result['path'];
$repo->create = $result['bcreate'];
$repo->writeable = $result['writeable'];
$repo->writeable = true;
$repo->enabled = $result['enabled'];
$repo->recycle = "";
$repo->setSlug($result['slug']);
$repo->isTemplate = intval($result['isTemplate']) == 1 ? true : false;
$repo->setInferOptionsFromParent(intval($result['inferOptionsFromParent']) == 1 ? true : false);
foreach ($options_result as $k => $v) {
if (strpos($v, '$phpserial$') !== false && strpos($v, '$phpserial$') === 0) {
$v = unserialize(substr($v, strlen('$phpserial$')));
} else {
if ($k == "META_SOURCES") {
$v = unserialize($v);
}
}
$repo->options[$k] = $v;
}
return $repo;
}
示例3: createTemplateChild
/**
* Create a child from this repository if it's a template
* @param string $newLabel
* @param array $newOptions
* @param string $owner
* @param string $uniqueUser
* @return Repository
*/
public function createTemplateChild($newLabel, $newOptions, $owner = null, $uniqueUser = null)
{
$repo = new Repository(0, $newLabel, $this->accessType);
$newOptions["CREATION_TIME"] = time();
if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
$newOptions["CREATION_USER"] = AuthService::getLoggedUser()->getId();
}
$repo->options = $newOptions;
$repo->setOwnerData($this->getId(), $owner, $uniqueUser);
$repo->setInferOptionsFromParent(true);
return $repo;
}
示例4: createTemplateChild
/**
* Create a child from this repository if it's a template
* @param string $newLabel
* @param array $newOptions
* @param string $owner
* @param string $uniqueUser
* @return Repository
*/
public function createTemplateChild($newLabel, $newOptions, $owner = null, $uniqueUser = null)
{
$repo = new Repository(0, $newLabel, $this->accessType);
$repo->options = $newOptions;
$repo->setOwnerData($this->getId(), $owner, $uniqueUser);
$repo->setInferOptionsFromParent(true);
return $repo;
}