repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
mpaleo/scaffolder | src/Scaffolder/Compilers/Layout/EditLayoutCompiler.php | EditLayoutCompiler.compile | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
$this->stub = $stub;
return $this->store(null, $scaffolderConfig, $themeExtension->runAfterEditLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null));
} | php | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
$this->stub = $stub;
return $this->store(null, $scaffolderConfig, $themeExtension->runAfterEditLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null));
} | [
"public",
"function",
"compile",
"(",
"$",
"stub",
",",
"$",
"modelName",
",",
"$",
"modelData",
",",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"hash",
",",
"ScaffolderThemeExtensionInterface",
"$",
"themeExtension",
",",
"array",
"$",
"extensions",
",",
... | Compiles the edit layout.
@param $stub
@param $modelName
@param $modelData
@param \stdClass $scaffolderConfig
@param $hash
@param \Scaffolder\Support\Contracts\ScaffolderThemeExtensionInterface $themeExtension
@param \Scaffolder\Support\Contracts\ScaffolderExtensionInterface[] $extensions
@param null $extra
@return string | [
"Compiles",
"the",
"edit",
"layout",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Layout/EditLayoutCompiler.php#L28-L33 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalogItemList.php | CNabuCatalogItemList.populate | public function populate(int $deep = 0)
{
$nb_catalog = $this->getCatalog();
$this->clear();
$this->merge(CNabuCatalogItem::getItemsForCatalog($nb_catalog, $deep));
$translations = CNabuCatalogItem::getItemTranslationsForCatalog($nb_catalog, $deep);
$translations->iterate(
function ($key, $translation)
{
$item = $this->getItem($translation->getCatalogItemId());
if ($item instanceof INabuTranslated) {
$item->setTranslation($translation);
}
return true;
}
);
} | php | public function populate(int $deep = 0)
{
$nb_catalog = $this->getCatalog();
$this->clear();
$this->merge(CNabuCatalogItem::getItemsForCatalog($nb_catalog, $deep));
$translations = CNabuCatalogItem::getItemTranslationsForCatalog($nb_catalog, $deep);
$translations->iterate(
function ($key, $translation)
{
$item = $this->getItem($translation->getCatalogItemId());
if ($item instanceof INabuTranslated) {
$item->setTranslation($translation);
}
return true;
}
);
} | [
"public",
"function",
"populate",
"(",
"int",
"$",
"deep",
"=",
"0",
")",
"{",
"$",
"nb_catalog",
"=",
"$",
"this",
"->",
"getCatalog",
"(",
")",
";",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"merge",
"(",
"CNabuCatalogItem",
"... | Populates the catalog with all Items.
@param int $deep If 0 all items are retrieved, else if great of 0, then retrieves only the first $deep levels. | [
"Populates",
"the",
"catalog",
"with",
"all",
"Items",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalogItemList.php#L49-L65 | train |
nabu-3/core | nabu/db/CNabuDBObject.php | CNabuDBObject.getDescriptor | public function getDescriptor($force = false)
{
if (!($this->storage_descriptor instanceof INabuDBDescriptor) || $force) {
$this->storage_descriptor = null;
$this->storage_descriptor = $this->db->getDescriptorFromFile($this->getStorageDescriptorPath());
}
return $this->storage_descriptor;
} | php | public function getDescriptor($force = false)
{
if (!($this->storage_descriptor instanceof INabuDBDescriptor) || $force) {
$this->storage_descriptor = null;
$this->storage_descriptor = $this->db->getDescriptorFromFile($this->getStorageDescriptorPath());
}
return $this->storage_descriptor;
} | [
"public",
"function",
"getDescriptor",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"storage_descriptor",
"instanceof",
"INabuDBDescriptor",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"storage_descriptor",
"... | Gets the Storage Descriptor. When calls this method the first time, an internal INabuDBDescriptor object
is created and returned next times.
@param bool $force If true the descriptor is recreated from scratch.
@return INabuDBDescriptor Returns the available descriptor instance.
@throws ENabuDBException Raises an exception if something happens when load the descriptor
from their serialized file. | [
"Gets",
"the",
"Storage",
"Descriptor",
".",
"When",
"calls",
"this",
"method",
"the",
"first",
"time",
"an",
"internal",
"INabuDBDescriptor",
"object",
"is",
"created",
"and",
"returned",
"next",
"times",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/db/CNabuDBObject.php#L147-L155 | train |
nabu-3/core | nabu/db/CNabuDBObject.php | CNabuDBObject.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
$this->relinkDB();
return $this->load();
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
$this->relinkDB();
return $this->load();
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"relinkDB",
"(",
")",
";",
"return",
"$",
"this",
"->",
"load",
"(",
")",
";",
"}"
] | Refresh data from the database storage.
@param bool $force Forces to reload entities from the database storage.
@param bool $cascade Forces to reload child entities from the database storage.
@return bool Returns true if data is refreshed. | [
"Refresh",
"data",
"from",
"the",
"database",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/db/CNabuDBObject.php#L285-L289 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.findByKey | public static function findByKey($nb_site, $key)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = CNabuSiteTarget::buildObjectFromSQL(
'select * '
. 'from nb_site_target '
. 'where nb_site_id=%site_id$d '
. "and nb_site_target_key='%key\$s'",
array(
'site_id' => $nb_site_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | public static function findByKey($nb_site, $key)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = CNabuSiteTarget::buildObjectFromSQL(
'select * '
. 'from nb_site_target '
. 'where nb_site_id=%site_id$d '
. "and nb_site_target_key='%key\$s'",
array(
'site_id' => $nb_site_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | [
"public",
"static",
"function",
"findByKey",
"(",
"$",
"nb_site",
",",
"$",
"key",
")",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"'nb_site_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
")",
"{",
... | Find an instance identified by nb_site_target_key field.
@param mixed $nb_site Site that owns Site Target
@param string $key Key to search
@return CNabuSiteTarget Returns a valid instance if exists or null if not. | [
"Find",
"an",
"instance",
"identified",
"by",
"nb_site_target_key",
"field",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L151-L170 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.getAllSiteTargets | public static function getAllSiteTargets(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_target_id',
'select * '
. 'from nb_site_target '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteTargetList();
}
return $retval;
} | php | public static function getAllSiteTargets(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_target_id',
'select * '
. 'from nb_site_target '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteTargetList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllSiteTargets",
"(",
"CNabuSite",
"$",
"nb_site",
")",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"'nb_site_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
")",
"{",
... | Get all items in the storage as an associative array where the field 'nb_site_target_id' is the index, and each
value is an instance of class CNabuSiteTargetBase.
@param CNabuSite $nb_site The CNabuSite instance of the Site that owns the Site Target List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_site_target_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuSiteTargetBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L178-L198 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setUseHTTP | public function setUseHTTP(string $use_http = "F") : CNabuDataObject
{
if ($use_http === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_http")
);
}
$this->setValue('nb_site_target_use_http', $use_http);
return $this;
} | php | public function setUseHTTP(string $use_http = "F") : CNabuDataObject
{
if ($use_http === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_http")
);
}
$this->setValue('nb_site_target_use_http', $use_http);
return $this;
} | [
"public",
"function",
"setUseHTTP",
"(",
"string",
"$",
"use_http",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"use_http",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_... | Sets the Site Target Use HTTP attribute value.
@param string $use_http New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Use",
"HTTP",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L564-L575 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setUseHTTPS | public function setUseHTTPS(string $use_https = "F") : CNabuDataObject
{
if ($use_https === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_https")
);
}
$this->setValue('nb_site_target_use_https', $use_https);
return $this;
} | php | public function setUseHTTPS(string $use_https = "F") : CNabuDataObject
{
if ($use_https === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_https")
);
}
$this->setValue('nb_site_target_use_https', $use_https);
return $this;
} | [
"public",
"function",
"setUseHTTPS",
"(",
"string",
"$",
"use_https",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"use_https",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_N... | Sets the Site Target Use HTTPS attribute value.
@param string $use_https New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Use",
"HTTPS",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L591-L602 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setAttachment | public function setAttachment(string $attachment = "F") : CNabuDataObject
{
if ($attachment === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$attachment")
);
}
$this->setValue('nb_site_target_attachment', $attachment);
return $this;
} | php | public function setAttachment(string $attachment = "F") : CNabuDataObject
{
if ($attachment === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$attachment")
);
}
$this->setValue('nb_site_target_attachment', $attachment);
return $this;
} | [
"public",
"function",
"setAttachment",
"(",
"string",
"$",
"attachment",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"attachment",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VAL... | Sets the Site Target Attachment attribute value.
@param string $attachment New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Attachment",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L639-L650 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setSmartyDebugging | public function setSmartyDebugging(string $smarty_debugging = "F") : CNabuDataObject
{
if ($smarty_debugging === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$smarty_debugging")
);
}
$this->setValue('nb_site_target_smarty_debugging', $smarty_debugging);
return $this;
} | php | public function setSmartyDebugging(string $smarty_debugging = "F") : CNabuDataObject
{
if ($smarty_debugging === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$smarty_debugging")
);
}
$this->setValue('nb_site_target_smarty_debugging', $smarty_debugging);
return $this;
} | [
"public",
"function",
"setSmartyDebugging",
"(",
"string",
"$",
"smarty_debugging",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"smarty_debugging",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
... | Sets the Site Target Smarty Debugging attribute value.
@param string $smarty_debugging New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Smarty",
"Debugging",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L771-L782 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setPHPTrace | public function setPHPTrace(string $php_trace = "F") : CNabuDataObject
{
if ($php_trace === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$php_trace")
);
}
$this->setValue('nb_site_target_php_trace', $php_trace);
return $this;
} | php | public function setPHPTrace(string $php_trace = "F") : CNabuDataObject
{
if ($php_trace === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$php_trace")
);
}
$this->setValue('nb_site_target_php_trace', $php_trace);
return $this;
} | [
"public",
"function",
"setPHPTrace",
"(",
"string",
"$",
"php_trace",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"php_trace",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_N... | Sets the Site Target PHP Trace attribute value.
@param string $php_trace New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"PHP",
"Trace",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L819-L830 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setIgnorePolicies | public function setIgnorePolicies(string $ignore_policies = "F") : CNabuDataObject
{
if ($ignore_policies === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$ignore_policies")
);
}
$this->setValue('nb_site_target_ignore_policies', $ignore_policies);
return $this;
} | php | public function setIgnorePolicies(string $ignore_policies = "F") : CNabuDataObject
{
if ($ignore_policies === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$ignore_policies")
);
}
$this->setValue('nb_site_target_ignore_policies', $ignore_policies);
return $this;
} | [
"public",
"function",
"setIgnorePolicies",
"(",
"string",
"$",
"ignore_policies",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"ignore_policies",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"... | Sets the Site Target Ignore Policies attribute value.
@param string $ignore_policies New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Ignore",
"Policies",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L846-L857 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setUseCommerce | public function setUseCommerce(string $use_commerce = "F") : CNabuDataObject
{
if ($use_commerce === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_commerce")
);
}
$this->setValue('nb_site_target_use_commerce', $use_commerce);
return $this;
} | php | public function setUseCommerce(string $use_commerce = "F") : CNabuDataObject
{
if ($use_commerce === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_commerce")
);
}
$this->setValue('nb_site_target_use_commerce', $use_commerce);
return $this;
} | [
"public",
"function",
"setUseCommerce",
"(",
"string",
"$",
"use_commerce",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"use_commerce",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NUL... | Sets the Site Target Use Commerce attribute value.
@param string $use_commerce New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Use",
"Commerce",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L873-L884 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setUseApps | public function setUseApps(string $use_apps = "F") : CNabuDataObject
{
if ($use_apps === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_apps")
);
}
$this->setValue('nb_site_target_use_apps', $use_apps);
return $this;
} | php | public function setUseApps(string $use_apps = "F") : CNabuDataObject
{
if ($use_apps === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_apps")
);
}
$this->setValue('nb_site_target_use_apps', $use_apps);
return $this;
} | [
"public",
"function",
"setUseApps",
"(",
"string",
"$",
"use_apps",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"use_apps",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_... | Sets the Site Target Use Apps attribute value.
@param string $use_apps New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Use",
"Apps",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L900-L911 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetBase.php | CNabuSiteTargetBase.setDynamicCacheControl | public function setDynamicCacheControl(string $dynamic_cache_control = "S") : CNabuDataObject
{
if ($dynamic_cache_control === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$dynamic_cache_control")
);
}
$this->setValue('nb_site_target_dynamic_cache_control', $dynamic_cache_control);
return $this;
} | php | public function setDynamicCacheControl(string $dynamic_cache_control = "S") : CNabuDataObject
{
if ($dynamic_cache_control === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$dynamic_cache_control")
);
}
$this->setValue('nb_site_target_dynamic_cache_control', $dynamic_cache_control);
return $this;
} | [
"public",
"function",
"setDynamicCacheControl",
"(",
"string",
"$",
"dynamic_cache_control",
"=",
"\"S\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"dynamic_cache_control",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreExcept... | Sets the Site Target Dynamic Cache Control attribute value.
@param string $dynamic_cache_control New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Dynamic",
"Cache",
"Control",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetBase.php#L927-L938 | train |
nabu-3/core | nabu/data/messaging/CNabuMessagingTemplate.php | CNabuMessagingTemplate.getActiveServices | public function getActiveServices(bool $force = false) : CNabuMessagingServiceList
{
if ($this->nb_messaging_service_list->isEmpty() || $force) {
$this->nb_messaging_service_list->clear();
if (($nb_messaging = $this->getMessaging()) instanceof CNabuMessaging &&
!($nb_services_list = $nb_messaging->getActiveServices())->isEmpty()
) {
$nb_services_list->iterate(function($key, CNabuMessagingService $nb_service) {
if ($nb_service->isTemplateConnected($this->getId())) {
$this->nb_messaging_service_list->addItem($nb_service);
}
return true;
});
}
}
return $this->nb_messaging_service_list;
} | php | public function getActiveServices(bool $force = false) : CNabuMessagingServiceList
{
if ($this->nb_messaging_service_list->isEmpty() || $force) {
$this->nb_messaging_service_list->clear();
if (($nb_messaging = $this->getMessaging()) instanceof CNabuMessaging &&
!($nb_services_list = $nb_messaging->getActiveServices())->isEmpty()
) {
$nb_services_list->iterate(function($key, CNabuMessagingService $nb_service) {
if ($nb_service->isTemplateConnected($this->getId())) {
$this->nb_messaging_service_list->addItem($nb_service);
}
return true;
});
}
}
return $this->nb_messaging_service_list;
} | [
"public",
"function",
"getActiveServices",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuMessagingServiceList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_messaging_service_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
... | Get the list of active Service instances connected to this Template.
@param bool $force If true, forces to refresh the list from the database storage.
@return CNabuMessagingServiceList Returns the list of connected services. | [
"Get",
"the",
"list",
"of",
"active",
"Service",
"instances",
"connected",
"to",
"this",
"Template",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessagingTemplate.php#L72-L89 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceStackBase.php | CNabuMessagingServiceStackBase.getAllMessagingServiceStacks | public static function getAllMessagingServiceStacks(CNabuMessaging $nb_messaging)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_service_stack_id',
'select * '
. 'from nb_messaging_service_stack '
. 'where nb_messaging_id=%messaging_id$d',
array(
'messaging_id' => $nb_messaging_id
),
$nb_messaging
);
} else {
$retval = new CNabuMessagingServiceStackList();
}
return $retval;
} | php | public static function getAllMessagingServiceStacks(CNabuMessaging $nb_messaging)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_service_stack_id',
'select * '
. 'from nb_messaging_service_stack '
. 'where nb_messaging_id=%messaging_id$d',
array(
'messaging_id' => $nb_messaging_id
),
$nb_messaging
);
} else {
$retval = new CNabuMessagingServiceStackList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllMessagingServiceStacks",
"(",
"CNabuMessaging",
"$",
"nb_messaging",
")",
"{",
"$",
"nb_messaging_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_messaging",
",",
"'nb_messaging_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
... | Get all items in the storage as an associative array where the field 'nb_messaging_service_stack_id' is the
index, and each value is an instance of class CNabuMessagingServiceStackBase.
@param CNabuMessaging $nb_messaging The CNabuMessaging instance of the Messaging that owns the Messaging Service
Stack List
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_messaging_service_stack_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuMessagingServiceStackBase",
"."
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceStackBase.php#L103-L123 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceStackBase.php | CNabuMessagingServiceStackBase.setMessagingId | public function setMessagingId(int $nb_messaging_id) : CNabuDataObject
{
if ($nb_messaging_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_id")
);
}
$this->setValue('nb_messaging_id', $nb_messaging_id);
return $this;
} | php | public function setMessagingId(int $nb_messaging_id) : CNabuDataObject
{
if ($nb_messaging_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_id")
);
}
$this->setValue('nb_messaging_id', $nb_messaging_id);
return $this;
} | [
"public",
"function",
"setMessagingId",
"(",
"int",
"$",
"nb_messaging_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_messaging_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALL... | Sets the Messaging Id attribute value.
@param int $nb_messaging_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Messaging",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceStackBase.php#L212-L223 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceStackBase.php | CNabuMessagingServiceStackBase.setMessagingServiceId | public function setMessagingServiceId(int $nb_messaging_service_id) : CNabuDataObject
{
if ($nb_messaging_service_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_service_id")
);
}
$this->setValue('nb_messaging_service_id', $nb_messaging_service_id);
return $this;
} | php | public function setMessagingServiceId(int $nb_messaging_service_id) : CNabuDataObject
{
if ($nb_messaging_service_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_service_id")
);
}
$this->setValue('nb_messaging_service_id', $nb_messaging_service_id);
return $this;
} | [
"public",
"function",
"setMessagingServiceId",
"(",
"int",
"$",
"nb_messaging_service_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_messaging_service_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"E... | Sets the Messaging Service Id attribute value.
@param int $nb_messaging_service_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Messaging",
"Service",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceStackBase.php#L239-L250 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceStackBase.php | CNabuMessagingServiceStackBase.setMessagingTemplateId | public function setMessagingTemplateId(int $nb_messaging_template_id) : CNabuDataObject
{
if ($nb_messaging_template_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_template_id")
);
}
$this->setValue('nb_messaging_template_id', $nb_messaging_template_id);
return $this;
} | php | public function setMessagingTemplateId(int $nb_messaging_template_id) : CNabuDataObject
{
if ($nb_messaging_template_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_template_id")
);
}
$this->setValue('nb_messaging_template_id', $nb_messaging_template_id);
return $this;
} | [
"public",
"function",
"setMessagingTemplateId",
"(",
"int",
"$",
"nb_messaging_template_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_messaging_template_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
... | Sets the Messaging Template Id attribute value.
@param int $nb_messaging_template_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Messaging",
"Template",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceStackBase.php#L266-L277 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectVersionBase.php | CNabuProjectVersionBase.getAllProjectVersions | public static function getAllProjectVersions(CNabuProject $nb_project)
{
$nb_project_id = nb_getMixedValue($nb_project, 'nb_project_id');
if (is_numeric($nb_project_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_project_version_id',
'select * '
. 'from nb_project_version '
. 'where nb_project_id=%project_id$d',
array(
'project_id' => $nb_project_id
),
$nb_project
);
} else {
$retval = new CNabuProjectVersionList();
}
return $retval;
} | php | public static function getAllProjectVersions(CNabuProject $nb_project)
{
$nb_project_id = nb_getMixedValue($nb_project, 'nb_project_id');
if (is_numeric($nb_project_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_project_version_id',
'select * '
. 'from nb_project_version '
. 'where nb_project_id=%project_id$d',
array(
'project_id' => $nb_project_id
),
$nb_project
);
} else {
$retval = new CNabuProjectVersionList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllProjectVersions",
"(",
"CNabuProject",
"$",
"nb_project",
")",
"{",
"$",
"nb_project_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_project",
",",
"'nb_project_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_project_id",
... | Get all items in the storage as an associative array where the field 'nb_project_version_id' is the index, and
each value is an instance of class CNabuProjectVersionBase.
@param CNabuProject $nb_project The CNabuProject instance that owns the Project Version List
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_project_version_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuProjectVersionBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectVersionBase.php#L151-L171 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectVersionBase.php | CNabuProjectVersionBase.getFilteredProjectVersionList | public static function getFilteredProjectVersionList($nb_project = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_project_id = nb_getMixedValue($nb_customer, NABU_PROJECT_FIELD_ID);
if (is_numeric($nb_project_id)) {
$fields_part = nb_prefixFieldList(CNabuProjectVersionBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuProjectVersionBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_project_version '
. 'where ' . NABU_PROJECT_FIELD_ID . '=%project_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'project_id' => $nb_project_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredProjectVersionList($nb_project = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_project_id = nb_getMixedValue($nb_customer, NABU_PROJECT_FIELD_ID);
if (is_numeric($nb_project_id)) {
$fields_part = nb_prefixFieldList(CNabuProjectVersionBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuProjectVersionBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_project_version '
. 'where ' . NABU_PROJECT_FIELD_ID . '=%project_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'project_id' => $nb_project_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredProjectVersionList",
"(",
"$",
"nb_project",
"=",
"null",
",",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
"=",... | Gets a filtered list of Project Version instances represented as an array. Params allows the capability of
select a subset of fields, order by concrete fields, or truncate the list by a number of rows starting in an
offset.
@throws \nabu\core\exceptions\ENabuCoreException Raises an exception if $fields or $order have invalid values.
@param mixed $nb_project Project instance, object containing a Project Id field or an Id.
@param string $q Query string to filter results using a context index.
@param string|array $fields List of fields to put in the results.
@param string|array $order List of fields to order the results. Each field can be suffixed with "ASC" or "DESC"
to determine the short order
@param int $offset Offset of first row in the results having the first row at offset 0.
@param int $num_items Number of continue rows to get as maximum in the results.
@return array Returns an array with all rows found using the criteria. | [
"Gets",
"a",
"filtered",
"list",
"of",
"Project",
"Version",
"instances",
"represented",
"as",
"an",
"array",
".",
"Params",
"allows",
"the",
"capability",
"of",
"select",
"a",
"subset",
"of",
"fields",
"order",
"by",
"concrete",
"fields",
"or",
"truncate",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectVersionBase.php#L187-L215 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectVersionBase.php | CNabuProjectVersionBase.setProjectId | public function setProjectId(int $nb_project_id) : CNabuDataObject
{
if ($nb_project_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_project_id")
);
}
$this->setValue('nb_project_id', $nb_project_id);
return $this;
} | php | public function setProjectId(int $nb_project_id) : CNabuDataObject
{
if ($nb_project_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_project_id")
);
}
$this->setValue('nb_project_id', $nb_project_id);
return $this;
} | [
"public",
"function",
"setProjectId",
"(",
"int",
"$",
"nb_project_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_project_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_I... | Sets the Project Id attribute value.
@param int $nb_project_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Project",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectVersionBase.php#L331-L342 | train |
rips/php-connector-bundle | Hydrators/LogHydrator.php | LogHydrator.hydrateCollection | public static function hydrateCollection(array $logs)
{
$hydrated = [];
foreach ($logs as $log) {
$hydrated[] = self::hydrate($log);
}
return $hydrated;
} | php | public static function hydrateCollection(array $logs)
{
$hydrated = [];
foreach ($logs as $log) {
$hydrated[] = self::hydrate($log);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"logs",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"logs",
"as",
"$",
"log",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
"$... | Hydrate a collection of log objects into a collection of
LogEntity objects
@param stdClass[] $logs
@return LogEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"log",
"objects",
"into",
"a",
"collection",
"of",
"LogEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/LogHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/LogHydrator.php | LogHydrator.hydrate | public static function hydrate(stdClass $log)
{
$hydrated = new LogEntity();
if (isset($log->id)) {
$hydrated->setId($log->id);
}
if (isset($log->text)) {
$hydrated->setText($log->text);
}
if (isset($log->level)) {
$hydrated->setLevel($log->level);
}
if (isset($log->channel)) {
$hydrated->setChannel($log->channel);
}
if (isset($log->request_uri)) {
$hydrated->setRequestUri($log->request_uri);
}
if (isset($log->request_method)) {
$hydrated->setRequestMethod($log->request_method);
}
if (isset($log->ip)) {
$hydrated->setIp($log->ip);
}
if (isset($log->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($log->created_by));
}
if (isset($log->email)) {
$hydrated->setEmail($log->email);
}
if (isset($log->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($log->organization));
}
if (isset($log->organization_name)) {
$hydrated->setOrganizationName($log->organization_name);
}
if (isset($log->context)) {
$hydrated->setContext($log->context);
}
if (isset($log->created_at)) {
$hydrated->setCreatedAt(new DateTime($log->created_at));
}
if (isset($log->user_agent)) {
$hydrated->setUserAgent($log->user_agent);
}
return $hydrated;
} | php | public static function hydrate(stdClass $log)
{
$hydrated = new LogEntity();
if (isset($log->id)) {
$hydrated->setId($log->id);
}
if (isset($log->text)) {
$hydrated->setText($log->text);
}
if (isset($log->level)) {
$hydrated->setLevel($log->level);
}
if (isset($log->channel)) {
$hydrated->setChannel($log->channel);
}
if (isset($log->request_uri)) {
$hydrated->setRequestUri($log->request_uri);
}
if (isset($log->request_method)) {
$hydrated->setRequestMethod($log->request_method);
}
if (isset($log->ip)) {
$hydrated->setIp($log->ip);
}
if (isset($log->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($log->created_by));
}
if (isset($log->email)) {
$hydrated->setEmail($log->email);
}
if (isset($log->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($log->organization));
}
if (isset($log->organization_name)) {
$hydrated->setOrganizationName($log->organization_name);
}
if (isset($log->context)) {
$hydrated->setContext($log->context);
}
if (isset($log->created_at)) {
$hydrated->setCreatedAt(new DateTime($log->created_at));
}
if (isset($log->user_agent)) {
$hydrated->setUserAgent($log->user_agent);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"log",
")",
"{",
"$",
"hydrated",
"=",
"new",
"LogEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"log",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
"... | Hydrate a log object into a LogEntity object
@param stdClass $log
@return LogEntity | [
"Hydrate",
"a",
"log",
"object",
"into",
"a",
"LogEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/LogHydrator.php#L35-L96 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Context/PartHydrator.php | PartHydrator.hydrateCollection | public static function hydrateCollection(array $parts)
{
$hydrated = [];
foreach ($parts as $part) {
$hydrated[] = self::hydrate($part);
}
return $hydrated;
} | php | public static function hydrateCollection(array $parts)
{
$hydrated = [];
foreach ($parts as $part) {
$hydrated[] = self::hydrate($part);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"parts",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parts",
"as",
"$",
"part",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of part objects into a collection of
PartEntity objects
@param stdClass[] $parts
@return PartEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"part",
"objects",
"into",
"a",
"collection",
"of",
"PartEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Context/PartHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Context/PartHydrator.php | PartHydrator.hydrate | public static function hydrate(stdClass $part)
{
$hydrated = new PartEntity();
if (isset($part->id)) {
$hydrated->setId($part->id);
}
if (isset($part->type)) {
$hydrated->setType($part->type);
}
if (isset($part->content)) {
$hydrated->setContent($part->content);
}
return $hydrated;
} | php | public static function hydrate(stdClass $part)
{
$hydrated = new PartEntity();
if (isset($part->id)) {
$hydrated->setId($part->id);
}
if (isset($part->type)) {
$hydrated->setType($part->type);
}
if (isset($part->content)) {
$hydrated->setContent($part->content);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"part",
")",
"{",
"$",
"hydrated",
"=",
"new",
"PartEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"part",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a part object into a PartEntity object
@param stdClass $part
@return PartEntity | [
"Hydrate",
"a",
"part",
"object",
"into",
"a",
"PartEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Context/PartHydrator.php#L35-L52 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.insert | public function insert($entity)
{
$eloquentModel = $this->getEloquentModel($entity);
$this->updateRelations($eloquentModel, 'insert');
$eloquentModel->save();
$eloquentModel->afterSaving($entity, 'insert');
} | php | public function insert($entity)
{
$eloquentModel = $this->getEloquentModel($entity);
$this->updateRelations($eloquentModel, 'insert');
$eloquentModel->save();
$eloquentModel->afterSaving($entity, 'insert');
} | [
"public",
"function",
"insert",
"(",
"$",
"entity",
")",
"{",
"$",
"eloquentModel",
"=",
"$",
"this",
"->",
"getEloquentModel",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"updateRelations",
"(",
"$",
"eloquentModel",
",",
"'insert'",
")",
";",
"$",... | Create an entity object.
@param object $entity
@return void | [
"Create",
"an",
"entity",
"object",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L57-L66 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.update | public function update($entity)
{
$eloquentModel = $this->getEloquentModel($entity, true);
$this->updateRelations($eloquentModel, 'update');
$eloquentModel->save();
$eloquentModel->afterSaving($entity, 'update');
} | php | public function update($entity)
{
$eloquentModel = $this->getEloquentModel($entity, true);
$this->updateRelations($eloquentModel, 'update');
$eloquentModel->save();
$eloquentModel->afterSaving($entity, 'update');
} | [
"public",
"function",
"update",
"(",
"$",
"entity",
")",
"{",
"$",
"eloquentModel",
"=",
"$",
"this",
"->",
"getEloquentModel",
"(",
"$",
"entity",
",",
"true",
")",
";",
"$",
"this",
"->",
"updateRelations",
"(",
"$",
"eloquentModel",
",",
"'update'",
"... | Update an entity object.
@param object $entity
@return void | [
"Update",
"an",
"entity",
"object",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L74-L83 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.updateRelations | protected function updateRelations($eloquentModel, $action)
{
$mapping = $eloquentModel->getMapping();
$eloquentRelations = $eloquentModel->getRelations();
foreach($mapping['relations'] as $name => $relationMapping) {
if (isset($eloquentRelations[$name])) {
$this->updateRelation($eloquentModel, $name, $relationMapping, $action);
}
}
} | php | protected function updateRelations($eloquentModel, $action)
{
$mapping = $eloquentModel->getMapping();
$eloquentRelations = $eloquentModel->getRelations();
foreach($mapping['relations'] as $name => $relationMapping) {
if (isset($eloquentRelations[$name])) {
$this->updateRelation($eloquentModel, $name, $relationMapping, $action);
}
}
} | [
"protected",
"function",
"updateRelations",
"(",
"$",
"eloquentModel",
",",
"$",
"action",
")",
"{",
"$",
"mapping",
"=",
"$",
"eloquentModel",
"->",
"getMapping",
"(",
")",
";",
"$",
"eloquentRelations",
"=",
"$",
"eloquentModel",
"->",
"getRelations",
"(",
... | Update relations.
@param \ProAI\Datamapper\Eloquent\Model $eloquentModel
@param string $action
@return void | [
"Update",
"relations",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L107-L117 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.updateRelation | protected function updateRelation($eloquentModel, $name, $relationMapping, $action)
{
// set foreign key for belongsTo/morphTo relation
if ($relationMapping['type'] == 'belongsTo' || $relationMapping['type'] == 'morphTo') {
$this->updateBelongsToRelation($eloquentModel, $name, $action);
}
// set foreign keys for belongsToMany/morphToMany relation
if (($relationMapping['type'] == 'belongsToMany' || $relationMapping['type'] == 'morphToMany') && ! $relationMapping['inverse']) {
$this->updateBelongsToManyRelation($eloquentModel, $name, $action);
}
} | php | protected function updateRelation($eloquentModel, $name, $relationMapping, $action)
{
// set foreign key for belongsTo/morphTo relation
if ($relationMapping['type'] == 'belongsTo' || $relationMapping['type'] == 'morphTo') {
$this->updateBelongsToRelation($eloquentModel, $name, $action);
}
// set foreign keys for belongsToMany/morphToMany relation
if (($relationMapping['type'] == 'belongsToMany' || $relationMapping['type'] == 'morphToMany') && ! $relationMapping['inverse']) {
$this->updateBelongsToManyRelation($eloquentModel, $name, $action);
}
} | [
"protected",
"function",
"updateRelation",
"(",
"$",
"eloquentModel",
",",
"$",
"name",
",",
"$",
"relationMapping",
",",
"$",
"action",
")",
"{",
"// set foreign key for belongsTo/morphTo relation",
"if",
"(",
"$",
"relationMapping",
"[",
"'type'",
"]",
"==",
"'b... | Update a relation.
@param \ProAI\Datamapper\Eloquent\Model $eloquentModel
@param string $name
@param array $relationMapping
@param string $action
@return void | [
"Update",
"a",
"relation",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L128-L139 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.updateBelongsToRelation | protected function updateBelongsToRelation($eloquentModel, $name, $action)
{
if ($action == 'insert' || $action == 'update') {
$eloquentModel->{$name}()->associate($eloquentModel->getRelation($name));
}
} | php | protected function updateBelongsToRelation($eloquentModel, $name, $action)
{
if ($action == 'insert' || $action == 'update') {
$eloquentModel->{$name}()->associate($eloquentModel->getRelation($name));
}
} | [
"protected",
"function",
"updateBelongsToRelation",
"(",
"$",
"eloquentModel",
",",
"$",
"name",
",",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"==",
"'insert'",
"||",
"$",
"action",
"==",
"'update'",
")",
"{",
"$",
"eloquentModel",
"->",
"{",
"... | Update a belongsTo or morphTo relation.
@param \ProAI\Datamapper\Eloquent\Model $eloquentModel
@param string $name
@param string $action
@return void | [
"Update",
"a",
"belongsTo",
"or",
"morphTo",
"relation",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L149-L154 | train |
markusjwetzel/laravel-datamapper | src/EntityManager.php | EntityManager.updateBelongsToManyRelation | protected function updateBelongsToManyRelation($eloquentModel, $name, $action)
{
$eloquentCollection = $eloquentModel->getRelation($name);
if (! $eloquentCollection instanceof \Illuminate\Database\Eloquent\Collection) {
throw new Exception("Many-to-many relation '".$name."' is not a valid collection");
}
// get related keys
$keys = [];
foreach($eloquentCollection as $item) {
$keys[] = $item->getKey();
}
// attach/sync/detach keys
if ($action == 'insert') {
$eloquentModel->{$name}()->attach($keys);
}
if ($action == 'update') {
$eloquentModel->{$name}()->sync($keys);
}
if ($action == 'delete') {
$eloquentModel->{$name}()->detach($keys);
}
} | php | protected function updateBelongsToManyRelation($eloquentModel, $name, $action)
{
$eloquentCollection = $eloquentModel->getRelation($name);
if (! $eloquentCollection instanceof \Illuminate\Database\Eloquent\Collection) {
throw new Exception("Many-to-many relation '".$name."' is not a valid collection");
}
// get related keys
$keys = [];
foreach($eloquentCollection as $item) {
$keys[] = $item->getKey();
}
// attach/sync/detach keys
if ($action == 'insert') {
$eloquentModel->{$name}()->attach($keys);
}
if ($action == 'update') {
$eloquentModel->{$name}()->sync($keys);
}
if ($action == 'delete') {
$eloquentModel->{$name}()->detach($keys);
}
} | [
"protected",
"function",
"updateBelongsToManyRelation",
"(",
"$",
"eloquentModel",
",",
"$",
"name",
",",
"$",
"action",
")",
"{",
"$",
"eloquentCollection",
"=",
"$",
"eloquentModel",
"->",
"getRelation",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"... | Update a belongsToMany or morphToMany relation.
@param \ProAI\Datamapper\Eloquent\Model $eloquentModel
@param string $name
@param string $action
@return void | [
"Update",
"a",
"belongsToMany",
"or",
"morphToMany",
"relation",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/EntityManager.php#L164-L189 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/ContextService.php | ContextService.getAll | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->contexts()
->getAll($appId, $scanId, $issueId, $queryParams);
return new ContextsResponse($response);
} | php | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->contexts()
->getAll($appId, $scanId, $issueId, $queryParams);
return new ContextsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(... | Get all contexts for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return ContextsResponse | [
"Get",
"all",
"contexts",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/ContextService.php#L35-L45 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/ContextService.php | ContextService.getById | public function getById($appId, $scanId, $issueId, $contextId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->contexts()
->getById($appId, $scanId, $issueId, $contextId, $queryParams);
return new ContextResponse($response);
} | php | public function getById($appId, $scanId, $issueId, $contextId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->contexts()
->getById($appId, $scanId, $issueId, $contextId, $queryParams);
return new ContextResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"$",
"contextId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
... | Get context for an issue by id
@param int $appId
@param int $scanId
@param int $issueId
@param int $contextId
@param array $queryParams
@return ContextResponse | [
"Get",
"context",
"for",
"an",
"issue",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/ContextService.php#L57-L67 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/GraphBuilder.php | GraphBuilder.getResults | protected function getResults($method)
{
if ($this->schema) {
// set root constraints
if (isset($this->constraints[$this->root])) {
$this->constraints[$this->root]($this->eloquentQuery);
}
// set eager load constraints
$this->eloquentQuery->setEagerLoads($this->parseRelationsFromSchema($this->schema, ''));
// execute query
$results = $this->eloquentQuery->$method();
// transform to data transfer objects
if ($results) {
$dtos = $results->toDataTransferObject($this->root, $this->schema, $this->transformations);
return [$this->root => $dtos];
}
}
return null;
} | php | protected function getResults($method)
{
if ($this->schema) {
// set root constraints
if (isset($this->constraints[$this->root])) {
$this->constraints[$this->root]($this->eloquentQuery);
}
// set eager load constraints
$this->eloquentQuery->setEagerLoads($this->parseRelationsFromSchema($this->schema, ''));
// execute query
$results = $this->eloquentQuery->$method();
// transform to data transfer objects
if ($results) {
$dtos = $results->toDataTransferObject($this->root, $this->schema, $this->transformations);
return [$this->root => $dtos];
}
}
return null;
} | [
"protected",
"function",
"getResults",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"schema",
")",
"{",
"// set root constraints",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"constraints",
"[",
"$",
"this",
"->",
"root",
"]",
")",
")",
... | Prepare query for execution.
@param string $method
@return array|null | [
"Prepare",
"query",
"for",
"execution",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/GraphBuilder.php#L81-L104 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/GraphBuilder.php | GraphBuilder.parseRelationsFromSchema | protected function parseRelationsFromSchema(array $schema, $path='')
{
$results = [];
foreach ($schema as $key => $value) {
if (! is_numeric($key)) {
// join relation
if (substr($key, 0, 3) != '...') {
$childPath = ($path)
? $path.'.'.$key
: $key;
$results[$childPath] = (isset($this->constraints[$this->root.'.'.$childPath]))
? $this->constraints[$this->root.'.'.$childPath]
: function () {};
} else {
$childPath = $path;
}
// recursive call
$results = array_merge($results, $this->parseRelationsFromSchema($value, $childPath));
}
}
return $results;
} | php | protected function parseRelationsFromSchema(array $schema, $path='')
{
$results = [];
foreach ($schema as $key => $value) {
if (! is_numeric($key)) {
// join relation
if (substr($key, 0, 3) != '...') {
$childPath = ($path)
? $path.'.'.$key
: $key;
$results[$childPath] = (isset($this->constraints[$this->root.'.'.$childPath]))
? $this->constraints[$this->root.'.'.$childPath]
: function () {};
} else {
$childPath = $path;
}
// recursive call
$results = array_merge($results, $this->parseRelationsFromSchema($value, $childPath));
}
}
return $results;
} | [
"protected",
"function",
"parseRelationsFromSchema",
"(",
"array",
"$",
"schema",
",",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"schema",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"... | Parse relations from schema.
@param array $schema
@param string $path
@return void | [
"Parse",
"relations",
"from",
"schema",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/GraphBuilder.php#L113-L137 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/GraphBuilder.php | GraphBuilder.schema | public function schema(array $schema)
{
$this->root = key($schema);
$this->schema = current($schema);
return $this;
} | php | public function schema(array $schema)
{
$this->root = key($schema);
$this->schema = current($schema);
return $this;
} | [
"public",
"function",
"schema",
"(",
"array",
"$",
"schema",
")",
"{",
"$",
"this",
"->",
"root",
"=",
"key",
"(",
"$",
"schema",
")",
";",
"$",
"this",
"->",
"schema",
"=",
"current",
"(",
"$",
"schema",
")",
";",
"return",
"$",
"this",
";",
"}"... | Set the schema.
@param array $schema
@return $this | [
"Set",
"the",
"schema",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/GraphBuilder.php#L145-L152 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Type/ResourceHydrator.php | ResourceHydrator.hydrateCollection | public static function hydrateCollection(array $resources)
{
$hydrated = [];
foreach ($resources as $resource) {
$hydrated[] = self::hydrate($resource);
}
return $hydrated;
} | php | public static function hydrateCollection(array $resources)
{
$hydrated = [];
foreach ($resources as $resource) {
$hydrated[] = self::hydrate($resource);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"resources",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"resources",
"as",
"$",
"resource",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrat... | Hydrate a collection of resource objects into a collection of
ResourceEntity objects
@param stdClass[] $resources
@return ResourceEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"resource",
"objects",
"into",
"a",
"collection",
"of",
"ResourceEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Type/ResourceHydrator.php#L19-L28 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Type/ResourceHydrator.php | ResourceHydrator.hydrate | public static function hydrate(stdClass $resource)
{
$hydrated = new ResourceEntity();
if (isset($resource->id)) {
$hydrated->setId($resource->id);
}
if (isset($resource->title)) {
$hydrated->setTitle($resource->title);
}
if (isset($resource->author)) {
$hydrated->setAuthor($resource->author);
}
if (isset($resource->url)) {
$hydrated->setUrl($resource->url);
}
if (isset($resource->published_at)) {
$hydrated->setPublishedAt(new DateTime($resource->published_at));
}
if (isset($resource->languages) && is_array($resource->languages)) {
$hydrated->setLanguages(LanguageHydrator::hydrateCollection($resource->languages));
}
return $hydrated;
} | php | public static function hydrate(stdClass $resource)
{
$hydrated = new ResourceEntity();
if (isset($resource->id)) {
$hydrated->setId($resource->id);
}
if (isset($resource->title)) {
$hydrated->setTitle($resource->title);
}
if (isset($resource->author)) {
$hydrated->setAuthor($resource->author);
}
if (isset($resource->url)) {
$hydrated->setUrl($resource->url);
}
if (isset($resource->published_at)) {
$hydrated->setPublishedAt(new DateTime($resource->published_at));
}
if (isset($resource->languages) && is_array($resource->languages)) {
$hydrated->setLanguages(LanguageHydrator::hydrateCollection($resource->languages));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"resource",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ResourceEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"resource",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
... | Hydrate a resource object into a ResourceEntity object
@param stdClass $resource
@return ResourceEntity | [
"Hydrate",
"a",
"resource",
"object",
"into",
"a",
"ResourceEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Type/ResourceHydrator.php#L36-L65 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteAliasBase.php | CNabuSiteAliasBase.getAllSiteAliass | public static function getAllSiteAliass(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_alias_id',
'select * '
. 'from nb_site_alias '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteAliasList();
}
return $retval;
} | php | public static function getAllSiteAliass(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_alias_id',
'select * '
. 'from nb_site_alias '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteAliasList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllSiteAliass",
"(",
"CNabuSite",
"$",
"nb_site",
")",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"'nb_site_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
")",
"{",
... | Get all items in the storage as an associative array where the field 'nb_site_alias_id' is the index, and each
value is an instance of class CNabuSiteAliasBase.
@param CNabuSite $nb_site The CNabuSite instance of the Site that owns the Site Alias List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_site_alias_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuSiteAliasBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasBase.php#L99-L119 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteAliasBase.php | CNabuSiteAliasBase.setDomainZoneHostId | public function setDomainZoneHostId(int $nb_domain_zone_host_id) : CNabuDataObject
{
if ($nb_domain_zone_host_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_domain_zone_host_id")
);
}
$this->setValue('nb_domain_zone_host_id', $nb_domain_zone_host_id);
return $this;
} | php | public function setDomainZoneHostId(int $nb_domain_zone_host_id) : CNabuDataObject
{
if ($nb_domain_zone_host_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_domain_zone_host_id")
);
}
$this->setValue('nb_domain_zone_host_id', $nb_domain_zone_host_id);
return $this;
} | [
"public",
"function",
"setDomainZoneHostId",
"(",
"int",
"$",
"nb_domain_zone_host_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_domain_zone_host_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR... | Sets the Domain Zone Host Id attribute value.
@param int $nb_domain_zone_host_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Domain",
"Zone",
"Host",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasBase.php#L253-L264 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteAliasBase.php | CNabuSiteAliasBase.setType | public function setType(string $type = "F") : CNabuDataObject
{
if ($type === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$type")
);
}
$this->setValue('nb_site_alias_type', $type);
return $this;
} | php | public function setType(string $type = "F") : CNabuDataObject
{
if ($type === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$type")
);
}
$this->setValue('nb_site_alias_type', $type);
return $this;
} | [
"public",
"function",
"setType",
"(",
"string",
"$",
"type",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN"... | Sets the Site Alias Type attribute value.
@param string $type New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Alias",
"Type",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasBase.php#L301-L312 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/TypeHydrator.php | TypeHydrator.hydrateCollection | public static function hydrateCollection(array $types)
{
$hydrated = [];
foreach ($types as $type) {
$hydrated[] = self::hydrate($type);
}
return $hydrated;
} | php | public static function hydrateCollection(array $types)
{
$hydrated = [];
foreach ($types as $type) {
$hydrated[] = self::hydrate($type);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"types",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"types",
"as",
"$",
"type",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of type objects into a collection of
TypeEntity objects
@param stdClass[] $types
@return TypeEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"type",
"objects",
"into",
"a",
"collection",
"of",
"TypeEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/TypeHydrator.php#L19-L28 | train |
nabu-3/core | nabu/visual/site/base/CNabuSiteVisualEditorItemBase.php | CNabuSiteVisualEditorItemBase.setVRId | public function setVRId(string $vr_id) : CNabuDataObject
{
if ($vr_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$vr_id")
);
}
$this->setValue('nb_site_visual_editor_item_vr_id', $vr_id);
return $this;
} | php | public function setVRId(string $vr_id) : CNabuDataObject
{
if ($vr_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$vr_id")
);
}
$this->setValue('nb_site_visual_editor_item_vr_id', $vr_id);
return $this;
} | [
"public",
"function",
"setVRId",
"(",
"string",
"$",
"vr_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"vr_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"arra... | Sets the Site Visual Editor Item VR Id attribute value.
@param string $vr_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Visual",
"Editor",
"Item",
"VR",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/visual/site/base/CNabuSiteVisualEditorItemBase.php#L176-L187 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.toDatamapperObject | public function toDatamapperObject()
{
// directly set private properties if entity extends the datamapper entity class (fast!)
if (is_subclass_of($this->class, '\ProAI\Datamapper\Support\Entity')) {
$class = $this->class;
return $class::newFromEloquentObject($this);
}
// set private properties via reflection (slow!)
$reflectionClass = new ReflectionClass($this->class);
$entity = $reflectionClass->newInstanceWithoutConstructor();
// attributes
foreach ($this->mapping['attributes'] as $attribute => $column) {
$this->setProperty(
$reflectionClass,
$entity,
$attribute,
$this->attributes[$column]
);
}
// embeddeds
foreach ($this->mapping['embeddeds'] as $name => $embedded) {
$embeddedReflectionClass = new ReflectionClass($embedded['class']);
$embeddedObject = $embeddedReflectionClass->newInstanceWithoutConstructor();
foreach ($embedded['attributes'] as $attribute => $column) {
// set property
$this->setProperty(
$embeddedReflectionClass,
$embeddedObject,
$attribute,
$this->attributes[$column]
);
}
$this->setProperty(
$reflectionClass,
$entity,
$name,
$embeddedObject
);
}
// relations
foreach ($this->mapping['relations'] as $name => $relation) {
// set relation object
if (! empty($this->relations[$name])) {
$relationObject = $this->relations[$name]->toDatamapperObject();
} elseif (in_array($relation['type'], $this->manyRelations)) {
$relationObject = new ProxyCollection;
} else {
$relationObject = new Proxy;
}
// set property
$this->setProperty(
$reflectionClass,
$entity,
$name,
$relationObject
);
}
return $entity;
} | php | public function toDatamapperObject()
{
// directly set private properties if entity extends the datamapper entity class (fast!)
if (is_subclass_of($this->class, '\ProAI\Datamapper\Support\Entity')) {
$class = $this->class;
return $class::newFromEloquentObject($this);
}
// set private properties via reflection (slow!)
$reflectionClass = new ReflectionClass($this->class);
$entity = $reflectionClass->newInstanceWithoutConstructor();
// attributes
foreach ($this->mapping['attributes'] as $attribute => $column) {
$this->setProperty(
$reflectionClass,
$entity,
$attribute,
$this->attributes[$column]
);
}
// embeddeds
foreach ($this->mapping['embeddeds'] as $name => $embedded) {
$embeddedReflectionClass = new ReflectionClass($embedded['class']);
$embeddedObject = $embeddedReflectionClass->newInstanceWithoutConstructor();
foreach ($embedded['attributes'] as $attribute => $column) {
// set property
$this->setProperty(
$embeddedReflectionClass,
$embeddedObject,
$attribute,
$this->attributes[$column]
);
}
$this->setProperty(
$reflectionClass,
$entity,
$name,
$embeddedObject
);
}
// relations
foreach ($this->mapping['relations'] as $name => $relation) {
// set relation object
if (! empty($this->relations[$name])) {
$relationObject = $this->relations[$name]->toDatamapperObject();
} elseif (in_array($relation['type'], $this->manyRelations)) {
$relationObject = new ProxyCollection;
} else {
$relationObject = new Proxy;
}
// set property
$this->setProperty(
$reflectionClass,
$entity,
$name,
$relationObject
);
}
return $entity;
} | [
"public",
"function",
"toDatamapperObject",
"(",
")",
"{",
"// directly set private properties if entity extends the datamapper entity class (fast!)",
"if",
"(",
"is_subclass_of",
"(",
"$",
"this",
"->",
"class",
",",
"'\\ProAI\\Datamapper\\Support\\Entity'",
")",
")",
"{",
"... | Convert model to entity object.
@return object | [
"Convert",
"model",
"to",
"entity",
"object",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L148-L216 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.setProperty | protected function setProperty(&$reflectionClass, $entity, $name, $value)
{
$property = $reflectionClass->getProperty($name);
$property->setAccessible(true);
$property->setValue($entity, $value);
} | php | protected function setProperty(&$reflectionClass, $entity, $name, $value)
{
$property = $reflectionClass->getProperty($name);
$property->setAccessible(true);
$property->setValue($entity, $value);
} | [
"protected",
"function",
"setProperty",
"(",
"&",
"$",
"reflectionClass",
",",
"$",
"entity",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"property",
"=",
"$",
"reflectionClass",
"->",
"getProperty",
"(",
"$",
"name",
")",
";",
"$",
"property",
... | Set a private property of an entity.
@param \ReflectionClass $reflectionClass
@param object $entity
@param string $name
@param mixed $value
@return void | [
"Set",
"a",
"private",
"property",
"of",
"an",
"entity",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L227-L232 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.toDataTransferObject | public function toDataTransferObject($root, $schema, $transformations, $path='')
{
$dto = new DataTransferObject();
// get morphed schema
if($this->morphClass) {
$morphKey = '...'.Str::studly($this->morphClass);
if (isset($schema[$morphKey])) {
$schema = $schema[$morphKey];
}
}
foreach ($schema as $key => $value) {
// entry is attribute
if (is_numeric($key)) {
// transformation key
$transformationKey = ($path)
? $root.'.'.$path.'.'.$value
: $root.'.'.$value;
// set value
if ($value == '__type') {
$dto->{$value} = class_basename($this->class);
} elseif (isset($transformations[$transformationKey])) {
$node = new GraphNode;
$transformations[$transformationKey]($node, $this->attributes);
$dto->{$value} = $node->getValue();
} elseif (isset($transformations['*.'.$value])) {
$node = new GraphNode;
$transformations['*.'.$value]($node, $this->attributes);
$dto->{$value} = $node->getValue();
} else {
$columnName = $this->getColumnName($value);
if (isset($this->attributes[$columnName])) {
$dto->{$value} = $this->attributes[$columnName];
}
}
}
// entry is relation
if (! is_numeric($key) && isset($this->relations[$key])) {
// set value and transform childs to dtos
$newPath = ($path) ? $path.'.'.$key : $key;
$dto->{$key} = $this->relations[$key]->toDataTransferObject(
$root,
$value,
$transformations,
$newPath
);
}
}
return $dto;
} | php | public function toDataTransferObject($root, $schema, $transformations, $path='')
{
$dto = new DataTransferObject();
// get morphed schema
if($this->morphClass) {
$morphKey = '...'.Str::studly($this->morphClass);
if (isset($schema[$morphKey])) {
$schema = $schema[$morphKey];
}
}
foreach ($schema as $key => $value) {
// entry is attribute
if (is_numeric($key)) {
// transformation key
$transformationKey = ($path)
? $root.'.'.$path.'.'.$value
: $root.'.'.$value;
// set value
if ($value == '__type') {
$dto->{$value} = class_basename($this->class);
} elseif (isset($transformations[$transformationKey])) {
$node = new GraphNode;
$transformations[$transformationKey]($node, $this->attributes);
$dto->{$value} = $node->getValue();
} elseif (isset($transformations['*.'.$value])) {
$node = new GraphNode;
$transformations['*.'.$value]($node, $this->attributes);
$dto->{$value} = $node->getValue();
} else {
$columnName = $this->getColumnName($value);
if (isset($this->attributes[$columnName])) {
$dto->{$value} = $this->attributes[$columnName];
}
}
}
// entry is relation
if (! is_numeric($key) && isset($this->relations[$key])) {
// set value and transform childs to dtos
$newPath = ($path) ? $path.'.'.$key : $key;
$dto->{$key} = $this->relations[$key]->toDataTransferObject(
$root,
$value,
$transformations,
$newPath
);
}
}
return $dto;
} | [
"public",
"function",
"toDataTransferObject",
"(",
"$",
"root",
",",
"$",
"schema",
",",
"$",
"transformations",
",",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"dto",
"=",
"new",
"DataTransferObject",
"(",
")",
";",
"// get morphed schema",
"if",
"(",
"$",
... | Convert model to data transfer object.
@param array $root
@param array $schema
@param array $transformations
@param string $path
@return object | [
"Convert",
"model",
"to",
"data",
"transfer",
"object",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L243-L296 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.newFromDatamapperObject | public static function newFromDatamapperObject(EntityContract $entity, $lastObjectId = null, $lastEloquentModel = null)
{
// directly get private properties if entity extends the datamapper entity class (fast!)
if ($entity instanceof \ProAI\Datamapper\Support\Entity) {
return $entity->toEloquentObject($lastObjectId, $lastEloquentModel);
}
// get private properties via reflection (slow!)
$class = get_mapped_model(get_class($entity));
$eloquentModel = new $class;
$reflectionObject = new ReflectionObject($entity);
$mapping = $eloquentModel->getMapping();
// attributes
foreach ($mapping['attributes'] as $attribute => $column) {
if (! $eloquentModel->isAutomaticallyUpdatedDate($column)) {
// get property
$property = $eloquentModel->getProperty(
$reflectionObject,
$entity,
$attribute
);
// set attribute
$eloquentModel->setAttribute($column, $property);
}
}
// embeddeds
foreach ($mapping['embeddeds'] as $name => $embedded) {
$embeddedObject = $eloquentModel->getProperty($reflectionObject, $entity, $name);
if (! empty($embeddedObject)) {
$embeddedReflectionObject = new ReflectionObject($embeddedObject);
foreach ($embedded['attributes'] as $attribute => $column) {
// get property
$property = $eloquentModel->getProperty(
$embeddedReflectionObject,
$embeddedObject,
$attribute
);
// set attribute
$eloquentModel->setAttribute($column, $property);
}
}
}
// relations
foreach ($mapping['relations'] as $name => $relation) {
$relationObject = $eloquentModel->getProperty(
$reflectionObject,
$entity,
$name
);
if (! empty($relationObject) && ! $relationObject instanceof \ProAI\Datamapper\Contracts\Proxy) {
// set relation
if ($relationObject instanceof \ProAI\Datamapper\Support\Collection) {
$value = EloquentCollection::newFromDatamapperObject($relationObject, $this, $eloquentModel);
} elseif (spl_object_hash($relationObject) == $lastObjectId) {
$value = $lastEloquentModel;
} else {
$value = EloquentModel::newFromDatamapperObject($relationObject, spl_object_hash($this), $eloquentModel);
}
$eloquentModel->setRelation($name, $value);
}
}
return $eloquentModel;
} | php | public static function newFromDatamapperObject(EntityContract $entity, $lastObjectId = null, $lastEloquentModel = null)
{
// directly get private properties if entity extends the datamapper entity class (fast!)
if ($entity instanceof \ProAI\Datamapper\Support\Entity) {
return $entity->toEloquentObject($lastObjectId, $lastEloquentModel);
}
// get private properties via reflection (slow!)
$class = get_mapped_model(get_class($entity));
$eloquentModel = new $class;
$reflectionObject = new ReflectionObject($entity);
$mapping = $eloquentModel->getMapping();
// attributes
foreach ($mapping['attributes'] as $attribute => $column) {
if (! $eloquentModel->isAutomaticallyUpdatedDate($column)) {
// get property
$property = $eloquentModel->getProperty(
$reflectionObject,
$entity,
$attribute
);
// set attribute
$eloquentModel->setAttribute($column, $property);
}
}
// embeddeds
foreach ($mapping['embeddeds'] as $name => $embedded) {
$embeddedObject = $eloquentModel->getProperty($reflectionObject, $entity, $name);
if (! empty($embeddedObject)) {
$embeddedReflectionObject = new ReflectionObject($embeddedObject);
foreach ($embedded['attributes'] as $attribute => $column) {
// get property
$property = $eloquentModel->getProperty(
$embeddedReflectionObject,
$embeddedObject,
$attribute
);
// set attribute
$eloquentModel->setAttribute($column, $property);
}
}
}
// relations
foreach ($mapping['relations'] as $name => $relation) {
$relationObject = $eloquentModel->getProperty(
$reflectionObject,
$entity,
$name
);
if (! empty($relationObject) && ! $relationObject instanceof \ProAI\Datamapper\Contracts\Proxy) {
// set relation
if ($relationObject instanceof \ProAI\Datamapper\Support\Collection) {
$value = EloquentCollection::newFromDatamapperObject($relationObject, $this, $eloquentModel);
} elseif (spl_object_hash($relationObject) == $lastObjectId) {
$value = $lastEloquentModel;
} else {
$value = EloquentModel::newFromDatamapperObject($relationObject, spl_object_hash($this), $eloquentModel);
}
$eloquentModel->setRelation($name, $value);
}
}
return $eloquentModel;
} | [
"public",
"static",
"function",
"newFromDatamapperObject",
"(",
"EntityContract",
"$",
"entity",
",",
"$",
"lastObjectId",
"=",
"null",
",",
"$",
"lastEloquentModel",
"=",
"null",
")",
"{",
"// directly get private properties if entity extends the datamapper entity class (fas... | Convert model to plain old php object.
@param \ProAI\Datamapper\Contracts\Entity $entity
@param string $lastObjectId
@param \ProAI\Datamapper\Eloquent\Model $lastEloquentModel
@return \ProAI\Datamapper\Eloquent\Model | [
"Convert",
"model",
"to",
"plain",
"old",
"php",
"object",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L306-L382 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.isAutomaticallyUpdatedDate | public function isAutomaticallyUpdatedDate($attribute)
{
// soft deletes
if (in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses(static::class)) && $attribute == $this->getDeletedAtColumn()) {
return true;
}
// timestamps
if ($this->timestamps && ($attribute == $this->getCreatedAtColumn() || $attribute == $this->getUpdatedAtColumn())) {
return true;
}
return false;
} | php | public function isAutomaticallyUpdatedDate($attribute)
{
// soft deletes
if (in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses(static::class)) && $attribute == $this->getDeletedAtColumn()) {
return true;
}
// timestamps
if ($this->timestamps && ($attribute == $this->getCreatedAtColumn() || $attribute == $this->getUpdatedAtColumn())) {
return true;
}
return false;
} | [
"public",
"function",
"isAutomaticallyUpdatedDate",
"(",
"$",
"attribute",
")",
"{",
"// soft deletes",
"if",
"(",
"in_array",
"(",
"'Illuminate\\Database\\Eloquent\\SoftDeletes'",
",",
"class_uses",
"(",
"static",
"::",
"class",
")",
")",
"&&",
"$",
"attribute",
"=... | Check if attribute is auto generated and updated date.
@param string $attribute
@return boolean | [
"Check",
"if",
"attribute",
"is",
"auto",
"generated",
"and",
"updated",
"date",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L390-L403 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.getProperty | protected function getProperty($reflectionObject, $entity, $name)
{
$property = $reflectionObject->getProperty($name);
$property->setAccessible(true);
return $property->getValue($entity);
} | php | protected function getProperty($reflectionObject, $entity, $name)
{
$property = $reflectionObject->getProperty($name);
$property->setAccessible(true);
return $property->getValue($entity);
} | [
"protected",
"function",
"getProperty",
"(",
"$",
"reflectionObject",
",",
"$",
"entity",
",",
"$",
"name",
")",
"{",
"$",
"property",
"=",
"$",
"reflectionObject",
"->",
"getProperty",
"(",
"$",
"name",
")",
";",
"$",
"property",
"->",
"setAccessible",
"(... | Get a private property of an entity.
@param \ReflectionObject $reflectionObject
@param object $entity
@param string $name
@param mixed $value
@return mixed | [
"Get",
"a",
"private",
"property",
"of",
"an",
"entity",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L414-L419 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Model.php | Model.getColumnName | protected function getColumnName($name)
{
// check attributes for given name
if (isset($this->mapping['attributes'][$name])) {
return $this->mapping['attributes'][$name];
}
// check embeddeds for given name
foreach($this->mapping['embeddeds'] as $embedded) {
// check for embedded attributes
if (isset($embedded['attributes'][$name])) {
return $embedded['attributes'][$name];
}
// check for embedded attributes using embedded column prefix
if ($embedded['columnPrefix'] && strpos($name, $embedded['columnPrefix']) === 0) {
$embeddedName = substr($name, strlen($embedded['columnPrefix']));
if (isset($embedded['attributes'][$embeddedName])) {
return $embedded['attributes'][$embeddedName];
}
}
}
} | php | protected function getColumnName($name)
{
// check attributes for given name
if (isset($this->mapping['attributes'][$name])) {
return $this->mapping['attributes'][$name];
}
// check embeddeds for given name
foreach($this->mapping['embeddeds'] as $embedded) {
// check for embedded attributes
if (isset($embedded['attributes'][$name])) {
return $embedded['attributes'][$name];
}
// check for embedded attributes using embedded column prefix
if ($embedded['columnPrefix'] && strpos($name, $embedded['columnPrefix']) === 0) {
$embeddedName = substr($name, strlen($embedded['columnPrefix']));
if (isset($embedded['attributes'][$embeddedName])) {
return $embedded['attributes'][$embeddedName];
}
}
}
} | [
"protected",
"function",
"getColumnName",
"(",
"$",
"name",
")",
"{",
"// check attributes for given name",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"mapping",
"[",
"'attributes'",
"]",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
... | Get column name of a schema name.
@param string $name
@return string | [
"Get",
"column",
"name",
"of",
"a",
"schema",
"name",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Model.php#L536-L559 | train |
nabu-3/core | nabu/http/managers/CNabuMediotecasManager.php | CNabuMediotecasManager.getMedioteca | public function getMedioteca($nb_medioteca)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID);
return is_numeric($nb_medioteca_id) || nb_isValidGUID($nb_medioteca_id)
? $this->nb_medioteca_list->getItem($nb_medioteca_id)
: false
;
} | php | public function getMedioteca($nb_medioteca)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID);
return is_numeric($nb_medioteca_id) || nb_isValidGUID($nb_medioteca_id)
? $this->nb_medioteca_list->getItem($nb_medioteca_id)
: false
;
} | [
"public",
"function",
"getMedioteca",
"(",
"$",
"nb_medioteca",
")",
"{",
"$",
"nb_medioteca_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_medioteca",
",",
"NABU_MEDIOTECA_FIELD_ID",
")",
";",
"return",
"is_numeric",
"(",
"$",
"nb_medioteca_id",
")",
"||",
"nb_isVal... | Gets a Medioteca Instance.
@param mixed $nb_medioteca A CNabuDataObject intance containing a field named 'nb_medioteca_id' or and ID.
@return mixed Returns the instance if exists or false if not. | [
"Gets",
"a",
"Medioteca",
"Instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuMediotecasManager.php#L93-L101 | train |
nabu-3/core | nabu/http/managers/CNabuMediotecasManager.php | CNabuMediotecasManager.getMediotecas | public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->merge(
CNabuMedioteca::getMediotecasForCustomer(CNabuEngine::getEngine()->getCustomer())
);
}
return $this->nb_medioteca_list;
} | php | public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->merge(
CNabuMedioteca::getMediotecasForCustomer(CNabuEngine::getEngine()->getCustomer())
);
}
return $this->nb_medioteca_list;
} | [
"public",
"function",
"getMediotecas",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_medioteca_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_medioteca_list",
"->",
"merge",
"(",
"C... | Gets the collection of Mediotecas
@param bool $force If true reload the medioteca collection from the database.
@return CNabuMediotecaList Return the list instance of Mediotecas. | [
"Gets",
"the",
"collection",
"of",
"Mediotecas"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuMediotecasManager.php#L108-L116 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.getLanguage | public function getLanguage($nb_language)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
if (is_numeric($nb_language_id) || nb_isValidGUID($nb_language_id)) {
$this->getLanguages();
if ($this->languages_list->containsKey($nb_language_id)) {
$retval = $this->languages_list->getItem($nb_language_id);
}
}
return $retval;
} | php | public function getLanguage($nb_language)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
if (is_numeric($nb_language_id) || nb_isValidGUID($nb_language_id)) {
$this->getLanguages();
if ($this->languages_list->containsKey($nb_language_id)) {
$retval = $this->languages_list->getItem($nb_language_id);
}
}
return $retval;
} | [
"public",
"function",
"getLanguage",
"(",
"$",
"nb_language",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_language_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_language",
",",
"NABU_LANG_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_lan... | Gets the language object owned by this object that represents a language entity allowed for them
@param mixed $nb_language Object containing a valid language ID or and ID directly
@return INabuTranslation If this entity owns the requested language returns a language instance
else returns null. | [
"Gets",
"the",
"language",
"object",
"owned",
"by",
"this",
"object",
"that",
"represents",
"a",
"language",
"entity",
"allowed",
"for",
"them"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L83-L96 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.setLanguage | public function setLanguage(CNabuLanguage $nb_language)
{
if ($nb_language->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_language->isValueGUID(NABU_LANG_FIELD_ID)) {
$nb_language_id = $nb_language->getValue(NABU_LANG_FIELD_ID);
$this->languages_list->addItem($nb_language);
}
} | php | public function setLanguage(CNabuLanguage $nb_language)
{
if ($nb_language->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_language->isValueGUID(NABU_LANG_FIELD_ID)) {
$nb_language_id = $nb_language->getValue(NABU_LANG_FIELD_ID);
$this->languages_list->addItem($nb_language);
}
} | [
"public",
"function",
"setLanguage",
"(",
"CNabuLanguage",
"$",
"nb_language",
")",
"{",
"if",
"(",
"$",
"nb_language",
"->",
"isValueNumeric",
"(",
"NABU_LANG_FIELD_ID",
")",
"||",
"$",
"nb_language",
"->",
"isValueGUID",
"(",
"NABU_LANG_FIELD_ID",
")",
")",
"{... | Add or replace a language object passed as parameter in the languages collection of this entity
@param CNabuLanguage $nb_language A instance of a language entity to add in the list of allowed languages | [
"Add",
"or",
"replace",
"a",
"language",
"object",
"passed",
"as",
"parameter",
"in",
"the",
"languages",
"collection",
"of",
"this",
"entity"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L102-L108 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.getTranslation | public function getTranslation($nb_language)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
if (is_numeric($nb_language_id) || nb_isValidGUID($nb_language_id)) {
$this->getTranslations();
if ($this->translations_list->containsKey($nb_language_id)) {
$retval = $this->translations_list->getItem($nb_language_id);
}
}
return $retval;
} | php | public function getTranslation($nb_language)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
if (is_numeric($nb_language_id) || nb_isValidGUID($nb_language_id)) {
$this->getTranslations();
if ($this->translations_list->containsKey($nb_language_id)) {
$retval = $this->translations_list->getItem($nb_language_id);
}
}
return $retval;
} | [
"public",
"function",
"getTranslation",
"(",
"$",
"nb_language",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_language_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_language",
",",
"NABU_LANG_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_... | Get the translation child object that represents the translated fields of this entity
@param mixed $nb_language Object containing a valid language ID or and ID directly
@return array|null Returns a child object derivated from this entity that represents
the translation part of fields | [
"Get",
"the",
"translation",
"child",
"object",
"that",
"represents",
"the",
"translated",
"fields",
"of",
"this",
"entity"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L128-L141 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.hasTranslations | public function hasTranslations(bool $force = false)
{
$this->getTranslations($force);
return $this->translations_list->isFilled();
} | php | public function hasTranslations(bool $force = false)
{
$this->getTranslations($force);
return $this->translations_list->isFilled();
} | [
"public",
"function",
"hasTranslations",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"getTranslations",
"(",
"$",
"force",
")",
";",
"return",
"$",
"this",
"->",
"translations_list",
"->",
"isFilled",
"(",
")",
";",
"}"
] | Check if the instance have at least one item in the translations collection.
@param bool $force If true, forces to reload from the storage all translations availables.
@return bool Returns true if the translations collection have at least one item. | [
"Check",
"if",
"the",
"instance",
"have",
"at",
"least",
"one",
"item",
"in",
"the",
"translations",
"collection",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L166-L172 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.setTranslation | public function setTranslation(INabuTranslation $nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_translation->setTranslatedObject($this);
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_list->addItem($nb_translation);
if ($this->translations_removed->containsKey($nb_language_id)) {
$this->translations_removed->removeItem($nb_language_id);
}
}
return $nb_translation;
} | php | public function setTranslation(INabuTranslation $nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_translation->setTranslatedObject($this);
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_list->addItem($nb_translation);
if ($this->translations_removed->containsKey($nb_language_id)) {
$this->translations_removed->removeItem($nb_language_id);
}
}
return $nb_translation;
} | [
"public",
"function",
"setTranslation",
"(",
"INabuTranslation",
"$",
"nb_translation",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkForValidTranslationInstance",
"(",
"$",
"nb_translation",
")",
"&&",
"(",
"$",
"nb_translation",
"->",
"isValueNumeric",
"(",
"NAB... | Add or replace a translation child object that represents the translated fields of this entity
@param INabuTranslation $nb_translation Translation child object to add / replace
@return CNabuDataObject Returns the translation setted. | [
"Add",
"or",
"replace",
"a",
"translation",
"child",
"object",
"that",
"represents",
"the",
"translated",
"fields",
"of",
"this",
"entity"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L179-L193 | train |
nabu-3/core | nabu/data/lang/traits/TNabuTranslated.php | TNabuTranslated.removeTranslation | public function removeTranslation($nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID)||
$nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_removed->addItem($nb_translation);
if ($this->translations_list->containsKey($nb_language_id)) {
$this->translations_list->removeItem($nb_translation);
}
}
} | php | public function removeTranslation($nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID)||
$nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_removed->addItem($nb_translation);
if ($this->translations_list->containsKey($nb_language_id)) {
$this->translations_list->removeItem($nb_translation);
}
}
} | [
"public",
"function",
"removeTranslation",
"(",
"$",
"nb_translation",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkForValidTranslationInstance",
"(",
"$",
"nb_translation",
")",
"&&",
"(",
"$",
"nb_translation",
"->",
"isValueNumeric",
"(",
"NABU_LANG_FIELD_ID",
... | Remove a translation child object from the internal list of this entity. If after this action
you calls updateTranslations method, then it call the delete method to remove definitely
this translation from the database
@param mixed $nb_translation Object containing a valid language ID or and ID directly | [
"Remove",
"a",
"translation",
"child",
"object",
"from",
"the",
"internal",
"list",
"of",
"this",
"entity",
".",
"If",
"after",
"this",
"action",
"you",
"calls",
"updateTranslations",
"method",
"then",
"it",
"call",
"the",
"delete",
"method",
"to",
"remove",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/traits/TNabuTranslated.php#L201-L213 | train |
markusjwetzel/laravel-datamapper | src/Console/SchemaCommand.php | SchemaCommand.getClasses | protected function getClasses()
{
$class = $this->argument('class');
// set classes
if ($class) {
if (class_exists($class)) {
$classes = [$class];
} elseif (class_exists($this->config['models_namespace'] . '\\' . $class)) {
$classes = [$this->config['models_namespace'] . '\\' . $class];
} else {
throw new UnexpectedValueException('Classname is not valid.');
}
} else {
$classes = $this->finder->getClassesFromNamespace($this->config['models_namespace']);
}
return $classes;
} | php | protected function getClasses()
{
$class = $this->argument('class');
// set classes
if ($class) {
if (class_exists($class)) {
$classes = [$class];
} elseif (class_exists($this->config['models_namespace'] . '\\' . $class)) {
$classes = [$this->config['models_namespace'] . '\\' . $class];
} else {
throw new UnexpectedValueException('Classname is not valid.');
}
} else {
$classes = $this->finder->getClassesFromNamespace($this->config['models_namespace']);
}
return $classes;
} | [
"protected",
"function",
"getClasses",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"argument",
"(",
"'class'",
")",
";",
"// set classes",
"if",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"$",
... | Get classes by class argument or by app namespace.
@return void | [
"Get",
"classes",
"by",
"class",
"argument",
"or",
"by",
"app",
"namespace",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Console/SchemaCommand.php#L75-L93 | train |
markusjwetzel/laravel-datamapper | src/Console/SchemaCommand.php | SchemaCommand.outputQueries | protected function outputQueries($statements)
{
$this->info(PHP_EOL . 'Outputting queries:');
if (empty($statements)) {
$this->info("No queries found.");
} else {
$this->info(implode(';' . PHP_EOL, $statements));
}
} | php | protected function outputQueries($statements)
{
$this->info(PHP_EOL . 'Outputting queries:');
if (empty($statements)) {
$this->info("No queries found.");
} else {
$this->info(implode(';' . PHP_EOL, $statements));
}
} | [
"protected",
"function",
"outputQueries",
"(",
"$",
"statements",
")",
"{",
"$",
"this",
"->",
"info",
"(",
"PHP_EOL",
".",
"'Outputting queries:'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"statements",
")",
")",
"{",
"$",
"this",
"->",
"info",
"(",
"\... | Output SQL queries.
@param array $statements SQL statements
@return void | [
"Output",
"SQL",
"queries",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Console/SchemaCommand.php#L101-L109 | train |
nabu-3/core | nabu/render/adapters/CNabuRenderInterfaceAdapter.php | CNabuRenderInterfaceAdapter.dumpFile | protected function dumpFile(string $filename)
{
if (strlen($filename) > 0 && file_exists($filename) && is_file($filename)) {
echo file_get_contents($filename);
return true;
}
return false;
} | php | protected function dumpFile(string $filename)
{
if (strlen($filename) > 0 && file_exists($filename) && is_file($filename)) {
echo file_get_contents($filename);
return true;
}
return false;
} | [
"protected",
"function",
"dumpFile",
"(",
"string",
"$",
"filename",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"filename",
")",
">",
"0",
"&&",
"file_exists",
"(",
"$",
"filename",
")",
"&&",
"is_file",
"(",
"$",
"filename",
")",
")",
"{",
"echo",
"fi... | Basic functionality to dump a file to the output stream.
@param string $filename File Name of file to be dumped.
@return bool Returns true if $filename exits and is a valid file and is dumped. | [
"Basic",
"functionality",
"to",
"dump",
"a",
"file",
"to",
"the",
"output",
"stream",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/adapters/CNabuRenderInterfaceAdapter.php#L134-L143 | train |
markusjwetzel/laravel-datamapper | src/Metadata/AnnotationLoader.php | AnnotationLoader.registerAll | public function registerAll()
{
foreach ($this->files->allFiles($this->path) as $file) {
AnnotationRegistry::registerFile($file->getRealPath());
}
} | php | public function registerAll()
{
foreach ($this->files->allFiles($this->path) as $file) {
AnnotationRegistry::registerFile($file->getRealPath());
}
} | [
"public",
"function",
"registerAll",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"files",
"->",
"allFiles",
"(",
"$",
"this",
"->",
"path",
")",
"as",
"$",
"file",
")",
"{",
"AnnotationRegistry",
"::",
"registerFile",
"(",
"$",
"file",
"->",
"get... | Register all annotations.
@return void | [
"Register",
"all",
"annotations",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/AnnotationLoader.php#L36-L41 | train |
nabu-3/core | nabu/data/site/CNabuSiteMapList.php | CNabuSiteMapList.populate | public function populate(int $deep = 0)
{
$nb_site = $this->getSite();
$this->merge(CNabuSiteMap::getMapsForSite($nb_site));
$translations = CNabuSiteMapLanguage::getMapTranslationsForSite($nb_site);
if (is_array($translations) && count($translations) > 0) {
foreach ($translations as $translation) {
$item = $this->getItem($translation->getSiteMapId());
$item->setTranslation($translation);
}
}
$roles = CNabuSiteMapRole::getMapRolesForSite($nb_site);
if (is_array($roles) && count($roles) > 0) {
foreach ($roles as $role) {
$item = $this->getItem($role->getSiteMapId());
$item->addRole($role);
}
}
} | php | public function populate(int $deep = 0)
{
$nb_site = $this->getSite();
$this->merge(CNabuSiteMap::getMapsForSite($nb_site));
$translations = CNabuSiteMapLanguage::getMapTranslationsForSite($nb_site);
if (is_array($translations) && count($translations) > 0) {
foreach ($translations as $translation) {
$item = $this->getItem($translation->getSiteMapId());
$item->setTranslation($translation);
}
}
$roles = CNabuSiteMapRole::getMapRolesForSite($nb_site);
if (is_array($roles) && count($roles) > 0) {
foreach ($roles as $role) {
$item = $this->getItem($role->getSiteMapId());
$item->addRole($role);
}
}
} | [
"public",
"function",
"populate",
"(",
"int",
"$",
"deep",
"=",
"0",
")",
"{",
"$",
"nb_site",
"=",
"$",
"this",
"->",
"getSite",
"(",
")",
";",
"$",
"this",
"->",
"merge",
"(",
"CNabuSiteMap",
"::",
"getMapsForSite",
"(",
"$",
"nb_site",
")",
")",
... | Populates the Site Map with all Items.
@param int $deep If 0 all items are retrieved, else if great than 0, then retrieves only the first $deep levels. | [
"Populates",
"the",
"Site",
"Map",
"with",
"all",
"Items",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteMapList.php#L54-L72 | train |
nabu-3/core | nabu/data/security/CNabuRoleList.php | CNabuRoleList.fillFromSite | public function fillFromSite($nb_site) : int
{
$this->clear();
$this->merge(CNabuRole::getRolesForSite($nb_site));
return $this->getSize();
} | php | public function fillFromSite($nb_site) : int
{
$this->clear();
$this->merge(CNabuRole::getRolesForSite($nb_site));
return $this->getSize();
} | [
"public",
"function",
"fillFromSite",
"(",
"$",
"nb_site",
")",
":",
"int",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"merge",
"(",
"CNabuRole",
"::",
"getRolesForSite",
"(",
"$",
"nb_site",
")",
")",
";",
"return",
"$",
"thi... | Clear the list and fill it from Roles assigned to a Site.
@param mixed $nb_site A Site instance, an object containing a field name nb_site_id or a Site Id.
@return int Returns the number of Roles found. | [
"Clear",
"the",
"list",
"and",
"fill",
"it",
"from",
"Roles",
"assigned",
"to",
"a",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuRoleList.php#L39-L45 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php | CNabuCommerceProductCategoryBase.findByKey | public static function findByKey($nb_commerce, $key)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProductCategory::buildObjectFromSQL(
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d '
. "and nb_commerce_product_category_key='%key\$s'",
array(
'commerce_id' => $nb_commerce_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | public static function findByKey($nb_commerce, $key)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProductCategory::buildObjectFromSQL(
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d '
. "and nb_commerce_product_category_key='%key\$s'",
array(
'commerce_id' => $nb_commerce_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | [
"public",
"static",
"function",
"findByKey",
"(",
"$",
"nb_commerce",
",",
"$",
"key",
")",
"{",
"$",
"nb_commerce_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce",
",",
"'nb_commerce_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_commerce_id",
... | Find an instance identified by nb_commerce_product_category_key field.
@param mixed $nb_commerce Commerce that owns Commerce Product Category
@param string $key Key to search
@return CNabuCommerceProductCategory Returns a valid instance if exists or null if not. | [
"Find",
"an",
"instance",
"identified",
"by",
"nb_commerce_product_category_key",
"field",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php#L154-L173 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php | CNabuCommerceProductCategoryBase.getAllCommerceProductCategories | public static function getAllCommerceProductCategories(CNabuCommerce $nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_commerce_product_category_id',
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
),
$nb_commerce
);
} else {
$retval = new CNabuCommerceProductCategoryList();
}
return $retval;
} | php | public static function getAllCommerceProductCategories(CNabuCommerce $nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_commerce_product_category_id',
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
),
$nb_commerce
);
} else {
$retval = new CNabuCommerceProductCategoryList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllCommerceProductCategories",
"(",
"CNabuCommerce",
"$",
"nb_commerce",
")",
"{",
"$",
"nb_commerce_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce",
",",
"'nb_commerce_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"n... | Get all items in the storage as an associative array where the field 'nb_commerce_product_category_id' is the
index, and each value is an instance of class CNabuCommerceProductCategoryBase.
@param CNabuCommerce $nb_commerce The CNabuCommerce instance of the Commerce that owns the Commerce Product
Category List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_commerce_product_category_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuCommerceProductCategoryBase",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php#L182-L202 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php | CNabuCommerceProductCategoryBase.setCommerceId | public function setCommerceId(int $nb_commerce_id) : CNabuDataObject
{
if ($nb_commerce_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_id")
);
}
$this->setValue('nb_commerce_id', $nb_commerce_id);
return $this;
} | php | public function setCommerceId(int $nb_commerce_id) : CNabuDataObject
{
if ($nb_commerce_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_id")
);
}
$this->setValue('nb_commerce_id', $nb_commerce_id);
return $this;
} | [
"public",
"function",
"setCommerceId",
"(",
"int",
"$",
"nb_commerce_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_commerce_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWE... | Sets the Commerce Id attribute value.
@param int $nb_commerce_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductCategoryBase.php#L383-L394 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ComparisonHydrator.php | ComparisonHydrator.hydrateCollection | public static function hydrateCollection(array $comparisons)
{
$hydrated = [];
foreach ($comparisons as $comparison) {
$hydrated[] = self::hydrate($comparison);
}
return $hydrated;
} | php | public static function hydrateCollection(array $comparisons)
{
$hydrated = [];
foreach ($comparisons as $comparison) {
$hydrated[] = self::hydrate($comparison);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"comparisons",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"comparisons",
"as",
"$",
"comparison",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"... | Hydrate a collection of concat objects into a collection of
ComparisonEntity objects
@param stdClass[] $comparisons
@return ComparisonEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"concat",
"objects",
"into",
"a",
"collection",
"of",
"ComparisonEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ComparisonHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ComparisonHydrator.php | ComparisonHydrator.hydrate | public static function hydrate(stdClass $comparison)
{
$hydrated = new ComparisonEntity();
if (isset($comparison->id)) {
$hydrated->setId($comparison->id);
}
if (isset($comparison->allowedMisses)) {
$hydrated->setAllowedMisses($comparison->allowedMisses);
}
if (isset($comparison->filesThreshold)) {
$hydrated->setFilesThreshold($comparison->filesThreshold);
}
if (isset($comparison->scannedOldFiles)) {
$hydrated->setScannedOldFiles($comparison->scannedOldFiles);
}
if (isset($comparison->scannedNewFiles)) {
$hydrated->setScannedNewFiles($comparison->scannedNewFiles);
}
if (isset($comparison->skippedOldFiles)) {
$hydrated->setSkippedOldFiles($comparison->skippedOldFiles);
}
if (isset($comparison->skippedNewFiles)) {
$hydrated->setSkippedNewFiles($comparison->skippedNewFiles);
}
if (isset($comparison->misses)) {
$hydrated->setMisses($comparison->misses);
}
return $hydrated;
} | php | public static function hydrate(stdClass $comparison)
{
$hydrated = new ComparisonEntity();
if (isset($comparison->id)) {
$hydrated->setId($comparison->id);
}
if (isset($comparison->allowedMisses)) {
$hydrated->setAllowedMisses($comparison->allowedMisses);
}
if (isset($comparison->filesThreshold)) {
$hydrated->setFilesThreshold($comparison->filesThreshold);
}
if (isset($comparison->scannedOldFiles)) {
$hydrated->setScannedOldFiles($comparison->scannedOldFiles);
}
if (isset($comparison->scannedNewFiles)) {
$hydrated->setScannedNewFiles($comparison->scannedNewFiles);
}
if (isset($comparison->skippedOldFiles)) {
$hydrated->setSkippedOldFiles($comparison->skippedOldFiles);
}
if (isset($comparison->skippedNewFiles)) {
$hydrated->setSkippedNewFiles($comparison->skippedNewFiles);
}
if (isset($comparison->misses)) {
$hydrated->setMisses($comparison->misses);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"comparison",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ComparisonEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"comparison",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setI... | Hydrate a comparison object into a ComparisonEntity object
@param stdClass $comparison
@return ComparisonEntity | [
"Hydrate",
"a",
"comparison",
"object",
"into",
"a",
"ComparisonEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ComparisonHydrator.php#L34-L71 | train |
nabu-3/core | nabu/data/messaging/CNabuMessaging.php | CNabuMessaging.getTemplates | public function getTemplates($force = false)
{
if ($this->nb_messaging_template_list === null) {
$this->nb_messaging_template_list = new CNabuMessagingTemplateList();
}
if ($this->nb_messaging_template_list->isEmpty() || $force) {
$this->nb_messaging_template_list->clear();
$this->nb_messaging_template_list->merge(CNabuMessagingTemplate::getAllMessagingTemplates($this));
$this->nb_messaging_template_list->iterate(function($key, CNabuMessagingTemplate $nb_template) {
$nb_template->setMessaging($this);
return true;
});
}
return $this->nb_messaging_template_list;
} | php | public function getTemplates($force = false)
{
if ($this->nb_messaging_template_list === null) {
$this->nb_messaging_template_list = new CNabuMessagingTemplateList();
}
if ($this->nb_messaging_template_list->isEmpty() || $force) {
$this->nb_messaging_template_list->clear();
$this->nb_messaging_template_list->merge(CNabuMessagingTemplate::getAllMessagingTemplates($this));
$this->nb_messaging_template_list->iterate(function($key, CNabuMessagingTemplate $nb_template) {
$nb_template->setMessaging($this);
return true;
});
}
return $this->nb_messaging_template_list;
} | [
"public",
"function",
"getTemplates",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_messaging_template_list",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"nb_messaging_template_list",
"=",
"new",
"CNabuMessagingTemplateList",
"(",
... | Get Templates assigned to this Messaging instance.
@param bool $force If true, the Messaging Template List is refreshed from the database.
@return CNabuMessagingTemplateList Returns the list of Templates. If noe Template exists, the list is empty. | [
"Get",
"Templates",
"assigned",
"to",
"this",
"Messaging",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessaging.php#L108-L124 | train |
nabu-3/core | nabu/data/messaging/CNabuMessaging.php | CNabuMessaging.getTemplate | public function getTemplate($nb_template)
{
$retval = false;
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$retval = $this->nb_messaging_template_list->getItem($nb_template_id);
if ($retval instanceof CNabuMessagingTemplate && $retval->getMessaging() === null) {
$retval->setMessaging($this);
}
}
return $retval;
} | php | public function getTemplate($nb_template)
{
$retval = false;
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$retval = $this->nb_messaging_template_list->getItem($nb_template_id);
if ($retval instanceof CNabuMessagingTemplate && $retval->getMessaging() === null) {
$retval->setMessaging($this);
}
}
return $retval;
} | [
"public",
"function",
"getTemplate",
"(",
"$",
"nb_template",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_template_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_template",
",",
"NABU_MESSAGING_TEMPLATE_FIELD_ID",
")",
")",
... | Gets a Template by Id.
@param mixed $nb_template A CNabuDataObject containing a field named nb_messaging_template_id or a valid Id.
@return CNabuMessagingTemplate|bool Returns the Messaging Template instance if exists or false if not. | [
"Gets",
"a",
"Template",
"by",
"Id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessaging.php#L131-L143 | train |
nabu-3/core | nabu/data/messaging/CNabuMessaging.php | CNabuMessaging.getTemplateByKey | public function getTemplateByKey(string $key)
{
$retval = false;
if (is_string($key) && strlen($key) > 0) {
$this->getTemplates();
$retval = $this->nb_messaging_template_list->getItem($key, CNabuMessagingTemplateList::INDEX_KEY);
}
return $retval;
} | php | public function getTemplateByKey(string $key)
{
$retval = false;
if (is_string($key) && strlen($key) > 0) {
$this->getTemplates();
$retval = $this->nb_messaging_template_list->getItem($key, CNabuMessagingTemplateList::INDEX_KEY);
}
return $retval;
} | [
"public",
"function",
"getTemplateByKey",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"&&",
"strlen",
"(",
"$",
"key",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"getTemplate... | Gets a Template by Key.
@param string $key A string Key representing the Template as defined in the database storage.
@return CNabuMessagingTemplate|bool Returns the Messaging Template instance if exists or false if not. | [
"Gets",
"a",
"Template",
"by",
"Key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessaging.php#L150-L160 | train |
nabu-3/core | nabu/data/messaging/CNabuMessaging.php | CNabuMessaging.getFactory | public function getFactory()
{
$nb_engine = CNabuEngine::getEngine();
if (!($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager)) {
$this->nb_messaging_pool_manager = CNabuEngine::getEngine()->getMessagingPoolManager();
}
if (!($this->nb_messaging_factory instanceof CNabuMessagingFactory)) {
$this->nb_messaging_factory = $this->nb_messaging_pool_manager->getFactory($this);
}
return $this->nb_messaging_factory;
} | php | public function getFactory()
{
$nb_engine = CNabuEngine::getEngine();
if (!($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager)) {
$this->nb_messaging_pool_manager = CNabuEngine::getEngine()->getMessagingPoolManager();
}
if (!($this->nb_messaging_factory instanceof CNabuMessagingFactory)) {
$this->nb_messaging_factory = $this->nb_messaging_pool_manager->getFactory($this);
}
return $this->nb_messaging_factory;
} | [
"public",
"function",
"getFactory",
"(",
")",
"{",
"$",
"nb_engine",
"=",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"nb_messaging_pool_manager",
"instanceof",
"CNabuMessagingPoolManager",
")",
")",
"{",
"$",
"th... | Get the Factory to produce and send messages. If she is not instantiates, then instantiates one and catches it.
@return CNabuMessagingFactory Returns the instance of the Factory.
@throws ENabuCoreException Raises an exception if Customer instance is not available or not matches with
@throws ENabuMessagingException Raises an exception if none Pool Manager available. | [
"Get",
"the",
"Factory",
"to",
"produce",
"and",
"send",
"messages",
".",
"If",
"she",
"is",
"not",
"instantiates",
"then",
"instantiates",
"one",
"and",
"catches",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessaging.php#L203-L216 | train |
markusjwetzel/laravel-datamapper | src/Providers/BaseServiceProvider.php | BaseServiceProvider.scanEntities | protected function scanEntities()
{
$app = $this->app;
// get classes
$classes = $app['datamapper.classfinder']->getClassesFromNamespace($app['config']['datamapper.models_namespace']);
// build metadata
$metadata = $app['datamapper.entity.scanner']->scan($classes, $app['config']['datamapper.namespace_tablenames'], $app['config']['datamapper.morphclass_abbreviations']);
// generate eloquent models
$app['datamapper.eloquent.generator']->generate($metadata, false);
// build schema
$app['datamapper.schema.builder']->update($metadata, false);
} | php | protected function scanEntities()
{
$app = $this->app;
// get classes
$classes = $app['datamapper.classfinder']->getClassesFromNamespace($app['config']['datamapper.models_namespace']);
// build metadata
$metadata = $app['datamapper.entity.scanner']->scan($classes, $app['config']['datamapper.namespace_tablenames'], $app['config']['datamapper.morphclass_abbreviations']);
// generate eloquent models
$app['datamapper.eloquent.generator']->generate($metadata, false);
// build schema
$app['datamapper.schema.builder']->update($metadata, false);
} | [
"protected",
"function",
"scanEntities",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"// get classes",
"$",
"classes",
"=",
"$",
"app",
"[",
"'datamapper.classfinder'",
"]",
"->",
"getClassesFromNamespace",
"(",
"$",
"app",
"[",
"'config'"... | Scan entity annotations and update database.
@return void | [
"Scan",
"entity",
"annotations",
"and",
"update",
"database",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Providers/BaseServiceProvider.php#L68-L83 | train |
markusjwetzel/laravel-datamapper | src/Providers/BaseServiceProvider.php | BaseServiceProvider.registerEloquentModels | protected function registerEloquentModels()
{
$files = $this->app['files']->files(storage_path('framework/entities'));
foreach ($files as $file) {
if ($this->app['files']->extension($file) == '') {
require_once $file;
}
}
} | php | protected function registerEloquentModels()
{
$files = $this->app['files']->files(storage_path('framework/entities'));
foreach ($files as $file) {
if ($this->app['files']->extension($file) == '') {
require_once $file;
}
}
} | [
"protected",
"function",
"registerEloquentModels",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"app",
"[",
"'files'",
"]",
"->",
"files",
"(",
"storage_path",
"(",
"'framework/entities'",
")",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"... | Load the compiled eloquent entity models.
@return void | [
"Load",
"the",
"compiled",
"eloquent",
"entity",
"models",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Providers/BaseServiceProvider.php#L90-L99 | train |
nabu-3/core | nabu/data/cluster/CNabuServer.php | CNabuServer.getSitesIndex | public function getSitesIndex() {
if ($this->isValueNumeric('nb_server_id')) {
$retval = CNabuSite::buildObjectListFromSQL('nb_site_id',
"SELECT distinct si.*
FROM nb_site si
INNER JOIN nb_cluster_group cg
ON si.nb_cluster_group_id=cg.nb_cluster_group_id
INNER JOIN nb_cluster_group_service cgs
ON cg.nb_cluster_group_id=cgs.nb_cluster_group_id
INNER JOIN nb_server_host sh
ON cgs.nb_cluster_group_service_id=sh.nb_cluster_group_service_id
INNER JOIN nb_server se
ON sh.nb_server_id=se.nb_server_id
AND se.nb_server_id=%server_id\$d
INNER JOIN nb_site_alias sa
ON si.nb_site_id=sa.nb_site_id
ORDER BY si.nb_site_mounting_order ASC",
array('server_id' => $this->getValue('nb_server_id'))
);
} else {
$retval = new CNabuSiteList();
}
return $retval;
} | php | public function getSitesIndex() {
if ($this->isValueNumeric('nb_server_id')) {
$retval = CNabuSite::buildObjectListFromSQL('nb_site_id',
"SELECT distinct si.*
FROM nb_site si
INNER JOIN nb_cluster_group cg
ON si.nb_cluster_group_id=cg.nb_cluster_group_id
INNER JOIN nb_cluster_group_service cgs
ON cg.nb_cluster_group_id=cgs.nb_cluster_group_id
INNER JOIN nb_server_host sh
ON cgs.nb_cluster_group_service_id=sh.nb_cluster_group_service_id
INNER JOIN nb_server se
ON sh.nb_server_id=se.nb_server_id
AND se.nb_server_id=%server_id\$d
INNER JOIN nb_site_alias sa
ON si.nb_site_id=sa.nb_site_id
ORDER BY si.nb_site_mounting_order ASC",
array('server_id' => $this->getValue('nb_server_id'))
);
} else {
$retval = new CNabuSiteList();
}
return $retval;
} | [
"public",
"function",
"getSitesIndex",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValueNumeric",
"(",
"'nb_server_id'",
")",
")",
"{",
"$",
"retval",
"=",
"CNabuSite",
"::",
"buildObjectListFromSQL",
"(",
"'nb_site_id'",
",",
"\"SELECT distinct si.*\n ... | Get all available sites to be indexed in the Web Server
@return CNabuSiteList Returns a list of all available sites if someone exists. | [
"Get",
"all",
"available",
"sites",
"to",
"be",
"indexed",
"in",
"the",
"Web",
"Server"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/CNabuServer.php#L44-L69 | train |
nabu-3/core | nabu/data/cluster/CNabuServer.php | CNabuServer.getAdminUser | public function getAdminUser($force = false) {
if ($this->nb_admin_user === null || $force) {
$this->nb_admin_user = null;
if ($this->isValueNumeric('nb_server_admin_user_id')) {
$nb_user = new CNabuUser($this->getAdminUserId());
if ($nb_user->isFetched()) {
$this->nb_admin_user = $nb_user;
}
}
}
return $this->nb_admin_user;
} | php | public function getAdminUser($force = false) {
if ($this->nb_admin_user === null || $force) {
$this->nb_admin_user = null;
if ($this->isValueNumeric('nb_server_admin_user_id')) {
$nb_user = new CNabuUser($this->getAdminUserId());
if ($nb_user->isFetched()) {
$this->nb_admin_user = $nb_user;
}
}
}
return $this->nb_admin_user;
} | [
"public",
"function",
"getAdminUser",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_admin_user",
"===",
"null",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_admin_user",
"=",
"null",
";",
"if",
"(",
"$",
"this",... | Gets the Admin User instance of this server instance.
@param bool $force If true forces to reload instance from the database storage.
@return CNabuUser Retuns a User instance if a user is assigned or null if none. | [
"Gets",
"the",
"Admin",
"User",
"instance",
"of",
"this",
"server",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/CNabuServer.php#L76-L89 | train |
danslo/CleanCheckoutGeo | src/Service/GeoService.php | GeoService.getCountry | public function getCountry()
{
try {
$address = $this->remoteAddress->getRemoteAddress();
return $this->getReader()->country($address)->country->isoCode;
} catch (\Exception $e) {
return null;
}
} | php | public function getCountry()
{
try {
$address = $this->remoteAddress->getRemoteAddress();
return $this->getReader()->country($address)->country->isoCode;
} catch (\Exception $e) {
return null;
}
} | [
"public",
"function",
"getCountry",
"(",
")",
"{",
"try",
"{",
"$",
"address",
"=",
"$",
"this",
"->",
"remoteAddress",
"->",
"getRemoteAddress",
"(",
")",
";",
"return",
"$",
"this",
"->",
"getReader",
"(",
")",
"->",
"country",
"(",
"$",
"address",
"... | Gets country from remote address.
@return null|string | [
"Gets",
"country",
"from",
"remote",
"address",
"."
] | 786553f29577ab139e0d1df96192dfc31e42d0fb | https://github.com/danslo/CleanCheckoutGeo/blob/786553f29577ab139e0d1df96192dfc31e42d0fb/src/Service/GeoService.php#L69-L77 | train |
nabu-3/core | nabu/render/CNabuRenderFactory.php | CNabuRenderFactory.render | public function render()
{
if ($this->discoverInterface()) {
$this->nb_interface->render();
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
} | php | public function render()
{
if ($this->discoverInterface()) {
$this->nb_interface->render();
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"discoverInterface",
"(",
")",
")",
"{",
"$",
"this",
"->",
"nb_interface",
"->",
"render",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ENabuRenderException",
"(",
"ENab... | This method render the content passed as parameter and exposes the result in the default output stream. | [
"This",
"method",
"render",
"the",
"content",
"passed",
"as",
"parameter",
"and",
"exposes",
"the",
"result",
"in",
"the",
"default",
"output",
"stream",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/CNabuRenderFactory.php#L54-L64 | train |
nabu-3/core | nabu/render/CNabuRenderFactory.php | CNabuRenderFactory.setMIMEType | public function setMIMEType(string $mimetype)
{
if ($this->discoverInterface()) {
$this->nb_interface->setMIMEType($mimetype);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
return $this;
} | php | public function setMIMEType(string $mimetype)
{
if ($this->discoverInterface()) {
$this->nb_interface->setMIMEType($mimetype);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
return $this;
} | [
"public",
"function",
"setMIMEType",
"(",
"string",
"$",
"mimetype",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"discoverInterface",
"(",
")",
")",
"{",
"$",
"this",
"->",
"nb_interface",
"->",
"setMIMEType",
"(",
"$",
"mimetype",
")",
";",
"}",
"else",
"... | Pass MIME Type to Render Instance.
@param string $mimetype MIME Type to be setted.
@return CNabuRenderFactory Returns self pointer to grant chained setter calls.
@throws ENabuRenderException Raises an exception if the Render Interface is not setted. | [
"Pass",
"MIME",
"Type",
"to",
"Render",
"Instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/CNabuRenderFactory.php#L72-L84 | train |
rips/php-connector-bundle | Services/Application/Profile/ControllerService.php | ControllerService.getAll | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->controllers()->getAll($appId, $profileId, $queryParams);
return new ControllersResponse($response);
} | php | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->controllers()->getAll($appId, $profileId, $queryParams);
return new ControllersResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"array",
"$",
"queryParams",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"profiles",
"(",
")",
"->",
"controllers",
"(",
... | Get all controllers for a profile profile
@param int $appId
@param int $profileId
@param array $queryParams
@return ControllersResponse | [
"Get",
"all",
"controllers",
"for",
"a",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/ControllerService.php#L36-L41 | train |
rips/php-connector-bundle | Services/Application/Profile/ControllerService.php | ControllerService.getById | public function getById($appId, $profileId, $controllerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->getById($appId, $profileId, $controllerId, $queryParams);
return new ControllerResponse($response);
} | php | public function getById($appId, $profileId, $controllerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->getById($appId, $profileId, $controllerId, $queryParams);
return new ControllerResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"$",
"controllerId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"pro... | Get controller for profile profile by id
@param int $appId
@param int $profileId
@param int $controllerId
@param array $queryParams
@return ControllerResponse | [
"Get",
"controller",
"for",
"profile",
"profile",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/ControllerService.php#L52-L57 | train |
rips/php-connector-bundle | Services/Application/Profile/ControllerService.php | ControllerService.create | public function create($appId, $profileId, ControllerBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->create($appId, $profileId, $input->toArray(), $queryParams);
return new ControllerResponse($response);
} | php | public function create($appId, $profileId, ControllerBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->create($appId, $profileId, $input->toArray(), $queryParams);
return new ControllerResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"ControllerBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",... | Create controller for profile profile
@param int $appId
@param int $profileId
@param ControllerBuilder $input
@param array $queryParams
@return ControllerResponse | [
"Create",
"controller",
"for",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/ControllerService.php#L68-L73 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/PatchService.php | PatchService.getAll | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getAll($appId, $scanId, $issueId, $queryParams);
return new PatchesResponse($response);
} | php | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getAll($appId, $scanId, $issueId, $queryParams);
return new PatchesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(... | Get all patches for an issue
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return PatchesResponse | [
"Get",
"all",
"patches",
"for",
"an",
"issue"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/PatchService.php#L37-L47 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/PatchService.php | PatchService.getById | public function getById($appId, $scanId, $issueId, $patchId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getById($appId, $scanId, $issueId, $patchId, $queryParams);
return new PatchResponse($response);
} | php | public function getById($appId, $scanId, $issueId, $patchId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getById($appId, $scanId, $issueId, $patchId, $queryParams);
return new PatchResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"$",
"patchId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
... | Get patch for an issue by id
@param int $appId
@param int $scanId
@param int $issueId
@param int $patchId
@param array $queryParams
@return PatchResponse | [
"Get",
"patch",
"for",
"an",
"issue",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/PatchService.php#L59-L69 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/ReviewHydrator.php | ReviewHydrator.hydrateCollection | public static function hydrateCollection(array $reviews)
{
$hydrated = [];
foreach ($reviews as $review) {
$hydrated[] = self::hydrate($review);
}
return $hydrated;
} | php | public static function hydrateCollection(array $reviews)
{
$hydrated = [];
foreach ($reviews as $review) {
$hydrated[] = self::hydrate($review);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"reviews",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"reviews",
"as",
"$",
"review",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
... | Hydrate a collection of review objects into a collection of
ReviewEntity objects
@param stdClass[] $reviews
@return ReviewEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"review",
"objects",
"into",
"a",
"collection",
"of",
"ReviewEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/ReviewHydrator.php#L21-L30 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/ReviewHydrator.php | ReviewHydrator.hydrate | public static function hydrate(stdClass $review)
{
$hydrated = new ReviewEntity();
if (isset($review->id)) {
$hydrated->setId($review->id);
}
if (isset($review->created_at)) {
$hydrated->setCreatedAt(new DateTime($review->created_at));
}
if (isset($review->type)) {
$hydrated->setType(ReviewTypeHydrator::hydrate($review->type));
}
if (isset($review->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($review->created_by));
}
if (isset($review->source)) {
$hydrated->setSource($review->source);
}
if (isset($review->issue)) {
$hydrated->setIssue(IssueHydrator::hydrate($review->issue));
}
return $hydrated;
} | php | public static function hydrate(stdClass $review)
{
$hydrated = new ReviewEntity();
if (isset($review->id)) {
$hydrated->setId($review->id);
}
if (isset($review->created_at)) {
$hydrated->setCreatedAt(new DateTime($review->created_at));
}
if (isset($review->type)) {
$hydrated->setType(ReviewTypeHydrator::hydrate($review->type));
}
if (isset($review->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($review->created_by));
}
if (isset($review->source)) {
$hydrated->setSource($review->source);
}
if (isset($review->issue)) {
$hydrated->setIssue(IssueHydrator::hydrate($review->issue));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"review",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ReviewEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"review",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
... | Hydrate a review object into a ReviewEntity object
@param stdClass $review
@return ReviewEntity | [
"Hydrate",
"a",
"review",
"object",
"into",
"a",
"ReviewEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/ReviewHydrator.php#L38-L67 | train |
nabu-3/core | nabu/data/icontact/traits/TNabuIContactProspectChild.php | TNabuIContactProspectChild.getIContactProspect | public function getIContactProspect($force = false)
{
if ($this->nb_icontact_prospect === null || $force) {
$this->nb_icontact_prospect = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_ICONTACT_PROSPECT_FIELD_ID)
) {
$nb_icontact_prospect = new CNabuIContactProspect($this->getValue(NABU_ICONTACT_PROSPECT_FIELD_ID));
if ($nb_icontact_prospect->isFetched()) {
$this->nb_icontact_prospect = $nb_icontact_prospect;
}
}
}
return $this->nb_icontact_prospect;
} | php | public function getIContactProspect($force = false)
{
if ($this->nb_icontact_prospect === null || $force) {
$this->nb_icontact_prospect = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_ICONTACT_PROSPECT_FIELD_ID)
) {
$nb_icontact_prospect = new CNabuIContactProspect($this->getValue(NABU_ICONTACT_PROSPECT_FIELD_ID));
if ($nb_icontact_prospect->isFetched()) {
$this->nb_icontact_prospect = $nb_icontact_prospect;
}
}
}
return $this->nb_icontact_prospect;
} | [
"public",
"function",
"getIContactProspect",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_icontact_prospect",
"===",
"null",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_icontact_prospect",
"=",
"null",
";",
"if",
... | Gets the iContact Prospect instance that owns this object.
@param bool $force If true forces to reload IContact Prospect from the database.
@return CNabuIContactProspect Returns the iContact instance if exists or null if not. | [
"Gets",
"the",
"iContact",
"Prospect",
"instance",
"that",
"owns",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/traits/TNabuIContactProspectChild.php#L49-L65 | train |
nabu-3/core | nabu/data/icontact/traits/TNabuIContactProspectChild.php | TNabuIContactProspectChild.setIContactProspect | public function setIContactProspect(CNabuIContactProspect $nb_icontact_prospect)
{
$this->nb_icontact_prospect = $nb_icontact_prospect;
if ($this instanceof CNabuDataObject && $nb_icontact_prospect->contains(NABU_ICONTACT_PROSPECT_FIELD_ID)) {
$this->transferValue($nb_icontact_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID);
}
return $this;
} | php | public function setIContactProspect(CNabuIContactProspect $nb_icontact_prospect)
{
$this->nb_icontact_prospect = $nb_icontact_prospect;
if ($this instanceof CNabuDataObject && $nb_icontact_prospect->contains(NABU_ICONTACT_PROSPECT_FIELD_ID)) {
$this->transferValue($nb_icontact_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID);
}
return $this;
} | [
"public",
"function",
"setIContactProspect",
"(",
"CNabuIContactProspect",
"$",
"nb_icontact_prospect",
")",
"{",
"$",
"this",
"->",
"nb_icontact_prospect",
"=",
"$",
"nb_icontact_prospect",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
"&&",
"$",
"n... | Sets the iContact Prospect instance that onws this object.
@param CNabuIContactProspect $nb_icontact_prospect The iContact Prospect instance to be setted.
@return mixed Return $this to grant cascade chain. | [
"Sets",
"the",
"iContact",
"Prospect",
"instance",
"that",
"onws",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/traits/TNabuIContactProspectChild.php#L72-L80 | train |
nabu-3/core | nabu/data/site/CNabuSiteTargetCTARole.php | CNabuSiteTargetCTARole.getCTARolesForSiteTarget | static public function getCTARolesForSiteTarget($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, NABU_SITE_TARGET_FIELD_ID);
if (is_numeric($nb_site_target_id)) {
$retval = CNabuEngine::getEngine()
->getMainDB()
->getQueryAsObjectArray(
'\nabu\data\site\CNabuSiteTargetCTARole', null,
'select stcr.* '
. 'from nb_site_target_cta stc, nb_site_target_cta_role stcr '
. 'where stc.nb_site_target_cta_id=stcr.nb_site_target_cta_id '
. 'and stc.nb_site_target_id=%target_id$d',
array(
'target_id' => $nb_site_target_id
)
)
;
} else {
$retval = null;
}
return $retval;
} | php | static public function getCTARolesForSiteTarget($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, NABU_SITE_TARGET_FIELD_ID);
if (is_numeric($nb_site_target_id)) {
$retval = CNabuEngine::getEngine()
->getMainDB()
->getQueryAsObjectArray(
'\nabu\data\site\CNabuSiteTargetCTARole', null,
'select stcr.* '
. 'from nb_site_target_cta stc, nb_site_target_cta_role stcr '
. 'where stc.nb_site_target_cta_id=stcr.nb_site_target_cta_id '
. 'and stc.nb_site_target_id=%target_id$d',
array(
'target_id' => $nb_site_target_id
)
)
;
} else {
$retval = null;
}
return $retval;
} | [
"static",
"public",
"function",
"getCTARolesForSiteTarget",
"(",
"$",
"nb_site_target",
")",
"{",
"$",
"nb_site_target_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site_target",
",",
"NABU_SITE_TARGET_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_t... | Get all roles to be applied to all CTAs of a Site Target.
@param mixed $nb_site_target Site Target to retrieve Site Target CTA Roles.
@return array|null Returns a Site Map Role List with roles. If no roles the list is empty. | [
"Get",
"all",
"roles",
"to",
"be",
"applied",
"to",
"all",
"CTAs",
"of",
"a",
"Site",
"Target",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTargetCTARole.php#L43-L65 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Collection.php | Collection.toDatamapperObject | public function toDatamapperObject()
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDatamapperObject());
}
return $entities;
} | php | public function toDatamapperObject()
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDatamapperObject());
}
return $entities;
} | [
"public",
"function",
"toDatamapperObject",
"(",
")",
"{",
"$",
"entities",
"=",
"new",
"DatamapperCollection",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"name",
"=>",
"$",
"item",
")",
"{",
"$",
"entities",
"->",
"put",
"(",
"$",
"na... | Convert models to entity objects.
@return \ProAI\Datamapper\Support\Collection | [
"Convert",
"models",
"to",
"entity",
"objects",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Collection.php#L16-L25 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Collection.php | Collection.toDataTransferObject | public function toDataTransferObject(string $root, array $schema, array $transformations, $path='')
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDataTransferObject($root, $schema, $transformations, $path));
}
return $entities;
} | php | public function toDataTransferObject(string $root, array $schema, array $transformations, $path='')
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDataTransferObject($root, $schema, $transformations, $path));
}
return $entities;
} | [
"public",
"function",
"toDataTransferObject",
"(",
"string",
"$",
"root",
",",
"array",
"$",
"schema",
",",
"array",
"$",
"transformations",
",",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"entities",
"=",
"new",
"DatamapperCollection",
";",
"foreach",
"(",
"$... | Convert models to data transfer objects.
@param string $root
@param array $schema
@param array $transformations
@param string $path
@return \ProAI\Datamapper\Support\Collection | [
"Convert",
"models",
"to",
"data",
"transfer",
"objects",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Collection.php#L36-L45 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Collection.php | Collection.newFromDatamapperObject | public static function newFromDatamapperObject($entities, $lastObjectId, $lastEloquentModel)
{
$eloquentModels = new static;
foreach ($entities as $name => $item) {
if (spl_object_hash($item) == $lastObjectId) {
$model = $lastEloquentModel;
} else {
$model = Model::newFromDatamapperObject($item, $lastObjectId, $lastEloquentModel);
}
$eloquentModels->put($name, $model);
}
return $eloquentModels;
} | php | public static function newFromDatamapperObject($entities, $lastObjectId, $lastEloquentModel)
{
$eloquentModels = new static;
foreach ($entities as $name => $item) {
if (spl_object_hash($item) == $lastObjectId) {
$model = $lastEloquentModel;
} else {
$model = Model::newFromDatamapperObject($item, $lastObjectId, $lastEloquentModel);
}
$eloquentModels->put($name, $model);
}
return $eloquentModels;
} | [
"public",
"static",
"function",
"newFromDatamapperObject",
"(",
"$",
"entities",
",",
"$",
"lastObjectId",
",",
"$",
"lastEloquentModel",
")",
"{",
"$",
"eloquentModels",
"=",
"new",
"static",
";",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"name",
"=>",
"$... | Convert models to eloquent models.
@param \ProAI\Datamapper\Support\Collection $entities
@param string $lastObjectId
@param \ProAI\Datamapper\Eloquent\Model $lastEloquentModel
@return \ProAI\Datamapper\Eloquent\Collection | [
"Convert",
"models",
"to",
"eloquent",
"models",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Collection.php#L55-L70 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingLanguageBase.php | CNabuMessagingLanguageBase.setTemplatesStatus | public function setTemplatesStatus(string $templates_status = "D") : CNabuDataObject
{
if ($templates_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$templates_status")
);
}
$this->setValue('nb_messaging_lang_templates_status', $templates_status);
return $this;
} | php | public function setTemplatesStatus(string $templates_status = "D") : CNabuDataObject
{
if ($templates_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$templates_status")
);
}
$this->setValue('nb_messaging_lang_templates_status', $templates_status);
return $this;
} | [
"public",
"function",
"setTemplatesStatus",
"(",
"string",
"$",
"templates_status",
"=",
"\"D\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"templates_status",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
... | Sets the Messaging Lang Templates Status attribute value.
@param string $templates_status New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Messaging",
"Lang",
"Templates",
"Status",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingLanguageBase.php#L238-L249 | train |
rips/php-connector-bundle | Services/LogService.php | LogService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->logs()->getAll($queryParams);
return new LogsResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->logs()->getAll($queryParams);
return new LogsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"logs",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"LogsResponse",
"("... | Get all logs
@param array $queryParams
@return LogsResponse | [
"Get",
"all",
"logs"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LogService.php#L33-L38 | train |
rips/php-connector-bundle | Services/LogService.php | LogService.getById | public function getById($logId, array $queryParams = [])
{
$response = $this->api->logs()->getById($logId, $queryParams);
return new LogResponse($response);
} | php | public function getById($logId, array $queryParams = [])
{
$response = $this->api->logs()->getById($logId, $queryParams);
return new LogResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"logId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"logs",
"(",
")",
"->",
"getById",
"(",
"$",
"logId",
",",
"$",
"queryParams",
")",... | Get a log by id
@param int $logId
@param array $queryParams
@return LogResponse | [
"Get",
"a",
"log",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LogService.php#L47-L52 | train |
rips/php-connector-bundle | Services/LogService.php | LogService.create | public function create(LogBuilder $input, array $queryParams = [])
{
$response = $this->api->logs()->create($input->toArray(), $queryParams);
return new LogResponse($response);
} | php | public function create(LogBuilder $input, array $queryParams = [])
{
$response = $this->api->logs()->create($input->toArray(), $queryParams);
return new LogResponse($response);
} | [
"public",
"function",
"create",
"(",
"LogBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"logs",
"(",
")",
"->",
"create",
"(",
"$",
"input",
"->",
"toArray",
... | Create a new log
@param LogBuilder $input
@param array $queryParams
@return LogResponse | [
"Create",
"a",
"new",
"log"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LogService.php#L61-L66 | train |
nabu-3/core | nabu/data/security/base/CNabuRoleBase.php | CNabuRoleBase.getAllRoles | public static function getAllRoles(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_role_id',
'select * '
. 'from nb_role '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuRoleList();
}
return $retval;
} | php | public static function getAllRoles(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_role_id',
'select * '
. 'from nb_role '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuRoleList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllRoles",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
")... | Get all items in the storage as an associative array where the field 'nb_role_id' is the index, and each value
is an instance of class CNabuRoleBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Role List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_role_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuRoleBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuRoleBase.php#L180-L200 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.