_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q3500
|
TNabuTranslated.setTranslation
|
train
|
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);
|
php
|
{
"resource": ""
}
|
q3501
|
TNabuTranslated.removeTranslation
|
train
|
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);
|
php
|
{
"resource": ""
}
|
q3502
|
SchemaCommand.getClasses
|
train
|
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];
|
php
|
{
"resource": ""
}
|
q3503
|
SchemaCommand.outputQueries
|
train
|
protected function outputQueries($statements)
{
$this->info(PHP_EOL . 'Outputting queries:');
if (empty($statements)) {
$this->info("No queries
|
php
|
{
"resource": ""
}
|
q3504
|
CNabuRenderInterfaceAdapter.dumpFile
|
train
|
protected function dumpFile(string $filename)
{
if (strlen($filename) > 0 && file_exists($filename) &&
|
php
|
{
"resource": ""
}
|
q3505
|
AnnotationLoader.registerAll
|
train
|
public function registerAll()
{
foreach ($this->files->allFiles($this->path) as
|
php
|
{
"resource": ""
}
|
q3506
|
CNabuSiteMapList.populate
|
train
|
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) {
|
php
|
{
"resource": ""
}
|
q3507
|
CNabuRoleList.fillFromSite
|
train
|
public function fillFromSite($nb_site) : int
{
$this->clear();
|
php
|
{
"resource": ""
}
|
q3508
|
CNabuCommerceProductCategoryBase.findByKey
|
train
|
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'",
|
php
|
{
"resource": ""
}
|
q3509
|
CNabuCommerceProductCategoryBase.getAllCommerceProductCategories
|
train
|
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
|
php
|
{
"resource": ""
}
|
q3510
|
CNabuCommerceProductCategoryBase.setCommerceId
|
train
|
public function setCommerceId(int $nb_commerce_id) : CNabuDataObject
{
if ($nb_commerce_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3511
|
ComparisonHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $comparisons)
{
$hydrated = [];
foreach ($comparisons as $comparison) {
|
php
|
{
"resource": ""
}
|
q3512
|
ComparisonHydrator.hydrate
|
train
|
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);
}
|
php
|
{
"resource": ""
}
|
q3513
|
CNabuMessaging.getTemplates
|
train
|
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));
|
php
|
{
"resource": ""
}
|
q3514
|
CNabuMessaging.getTemplate
|
train
|
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);
|
php
|
{
"resource": ""
}
|
q3515
|
CNabuMessaging.getTemplateByKey
|
train
|
public function getTemplateByKey(string $key)
{
$retval = false;
if (is_string($key) && strlen($key) > 0) {
$this->getTemplates();
|
php
|
{
"resource": ""
}
|
q3516
|
CNabuMessaging.getFactory
|
train
|
public function getFactory()
{
$nb_engine = CNabuEngine::getEngine();
if (!($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager)) {
$this->nb_messaging_pool_manager = CNabuEngine::getEngine()->getMessagingPoolManager();
}
|
php
|
{
"resource": ""
}
|
q3517
|
BaseServiceProvider.scanEntities
|
train
|
protected function scanEntities()
{
$app = $this->app;
// get classes
$classes = $app['datamapper.classfinder']->getClassesFromNamespace($app['config']['datamapper.models_namespace']);
// build metadata
$metadata =
|
php
|
{
"resource": ""
}
|
q3518
|
BaseServiceProvider.registerEloquentModels
|
train
|
protected function registerEloquentModels()
{
$files = $this->app['files']->files(storage_path('framework/entities'));
|
php
|
{
"resource": ""
}
|
q3519
|
CNabuServer.getSitesIndex
|
train
|
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
|
php
|
{
"resource": ""
}
|
q3520
|
CNabuServer.getAdminUser
|
train
|
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());
|
php
|
{
"resource": ""
}
|
q3521
|
GeoService.getCountry
|
train
|
public function getCountry()
{
try {
$address = $this->remoteAddress->getRemoteAddress();
|
php
|
{
"resource": ""
}
|
q3522
|
CNabuRenderFactory.render
|
train
|
public function render()
{
if ($this->discoverInterface()) {
$this->nb_interface->render();
} else {
|
php
|
{
"resource": ""
}
|
q3523
|
CNabuRenderFactory.setMIMEType
|
train
|
public function setMIMEType(string $mimetype)
{
if ($this->discoverInterface()) {
$this->nb_interface->setMIMEType($mimetype);
} else {
throw new ENabuRenderException(
|
php
|
{
"resource": ""
}
|
q3524
|
ControllerService.getAll
|
train
|
public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->controllers()->getAll($appId,
|
php
|
{
"resource": ""
}
|
q3525
|
ControllerService.getById
|
train
|
public function getById($appId, $profileId, $controllerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->getById($appId,
|
php
|
{
"resource": ""
}
|
q3526
|
ControllerService.create
|
train
|
public function create($appId, $profileId, ControllerBuilder $input, array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3527
|
PatchService.getAll
|
train
|
public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3528
|
PatchService.getById
|
train
|
public function getById($appId, $scanId, $issueId, $patchId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3529
|
ReviewHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $reviews)
{
$hydrated = [];
foreach ($reviews as $review) {
|
php
|
{
"resource": ""
}
|
q3530
|
ReviewHydrator.hydrate
|
train
|
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)) {
|
php
|
{
"resource": ""
}
|
q3531
|
TNabuIContactProspectChild.getIContactProspect
|
train
|
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));
|
php
|
{
"resource": ""
}
|
q3532
|
TNabuIContactProspectChild.setIContactProspect
|
train
|
public function setIContactProspect(CNabuIContactProspect $nb_icontact_prospect)
{
$this->nb_icontact_prospect = $nb_icontact_prospect;
if ($this
|
php
|
{
"resource": ""
}
|
q3533
|
CNabuSiteTargetCTARole.getCTARolesForSiteTarget
|
train
|
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 '
|
php
|
{
"resource": ""
}
|
q3534
|
Collection.toDatamapperObject
|
train
|
public function toDatamapperObject()
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
|
php
|
{
"resource": ""
}
|
q3535
|
Collection.toDataTransferObject
|
train
|
public function toDataTransferObject(string $root, array $schema, array $transformations, $path='')
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
|
php
|
{
"resource": ""
}
|
q3536
|
Collection.newFromDatamapperObject
|
train
|
public static function newFromDatamapperObject($entities, $lastObjectId, $lastEloquentModel)
{
$eloquentModels = new static;
foreach ($entities as $name => $item) {
if (spl_object_hash($item) == $lastObjectId) {
$model = $lastEloquentModel;
} else
|
php
|
{
"resource": ""
}
|
q3537
|
CNabuMessagingLanguageBase.setTemplatesStatus
|
train
|
public function setTemplatesStatus(string $templates_status = "D") : CNabuDataObject
{
if ($templates_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3538
|
LogService.getAll
|
train
|
public function getAll(array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3539
|
LogService.getById
|
train
|
public function getById($logId, array $queryParams = [])
{
$response = $this->api->logs()->getById($logId,
|
php
|
{
"resource": ""
}
|
q3540
|
LogService.create
|
train
|
public function create(LogBuilder $input, array $queryParams = [])
{
$response = $this->api->logs()->create($input->toArray(),
|
php
|
{
"resource": ""
}
|
q3541
|
CNabuRoleBase.getAllRoles
|
train
|
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
|
php
|
{
"resource": ""
}
|
q3542
|
CNabuRoleBase.setRoot
|
train
|
public function setRoot(string $root = "F") : CNabuDataObject
{
if ($root === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3543
|
PatchHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $patches)
{
$hydrated = [];
foreach ($patches as $patch) {
|
php
|
{
"resource": ""
}
|
q3544
|
CNabuSiteTargetSection.getSiteTargetSections
|
train
|
static public function getSiteTargetSections($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, 'nb_site_target_id');
if (is_numeric($nb_site_target_id)) {
$retval = CNabuSiteTargetSection::buildObjectListFromSQL(
'nb_site_target_section_id',
'select * '
. 'from nb_site_target_section '
. 'where nb_site_target_id=%target_id$d '
. 'order by nb_site_target_section_order',
array(
'target_id' => $nb_site_target_id
|
php
|
{
"resource": ""
}
|
q3545
|
CNabuEngine.registerApplication
|
train
|
public function registerApplication(INabuApplication $nb_application)
{
if ($this->nb_application !== null) {
throw new ENabuCoreException(ENabuCoreException::ERROR_RUNNING_APPLICATION);
}
|
php
|
{
"resource": ""
}
|
q3546
|
CNabuEngine.getMessagingPoolManager
|
train
|
public function getMessagingPoolManager(bool $force = false) : CNabuMessagingPoolManager
{
if ($this->nb_customer instanceof CNabuCustomer) {
if ($this->nb_messaging_pool_manager === null || $force) {
if ($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager) {
$this->nb_messaging_pool_manager->finish();
}
$this->nb_messaging_pool_manager = new CNabuMessagingPoolManager($this->nb_customer);
$this->nb_messaging_pool_manager->init();
} elseif (
!(($nb_aux_customer = $this->nb_messaging_pool_manager->getCustomer()) instanceof CNabuCustomer) ||
|
php
|
{
"resource": ""
}
|
q3547
|
CNabuEngine.getRenderPoolManager
|
train
|
public function getRenderPoolManager(bool $force = false) : CNabuRenderPoolManager
{
if ($this->nb_customer instanceof CNabuCustomer) {
if ($this->nb_render_pool_manager === null || $force) {
if ($this->nb_render_pool_manager instanceof CNabuRenderPoolManager) {
$this->nb_render_pool_manager->finish();
}
$this->nb_render_pool_manager = new CNabuRenderPoolManager($this->nb_customer);
$this->nb_render_pool_manager->init();
} elseif (
!(($nb_aux_customer = $this->nb_render_pool_manager->getCustomer()) instanceof CNabuCustomer) ||
|
php
|
{
"resource": ""
}
|
q3548
|
CNabuEngine.getHTTPServerPoolManager
|
train
|
public function getHTTPServerPoolManager(bool $force = false) : CNabuHTTPServerPoolManager
{
if ($this->nb_http_server_pool_manager === null || $force) {
if ($this->nb_http_server_pool_manager instanceof CNabuHTTPServerPoolManager) {
$this->nb_http_server_pool_manager->finish();
}
|
php
|
{
"resource": ""
}
|
q3549
|
CNabuEngine.class2Filename
|
train
|
private function class2Filename($class_name, $php_suffix = '.php')
{
return DIRECTORY_SEPARATOR
|
php
|
{
"resource": ""
}
|
q3550
|
CNabuEngine.init
|
train
|
private function init()
{
$this->microtime_start = microtime(true);
$this->nb_os = CNabuOS::getOS();
try {
$this->registerHandlers();
$this->registerProviderFactory();
} catch (ENabuException $nb_exception) {
if ($this->isCLIEnvironment()) {
|
php
|
{
"resource": ""
}
|
q3551
|
CNabuEngine.finish
|
train
|
private function finish()
{
if ($this->main_database !== null) {
$this->main_database->disconnect();
}
$this->microtime_end = microtime(true);
|
php
|
{
"resource": ""
}
|
q3552
|
CNabuEngine.registerMainDatabase
|
train
|
private function registerMainDatabase()
{
$filename = NABU_ETC_PATH.DIRECTORY_SEPARATOR.NABU_DB_DEFAULT_FILENAME_CONFIG;
if (!file_exists($filename) && ($file = fopen($filename, "w")) !== false) {
fwrite($file,
"<?php\n".
"\$db_user = \"nabu-3\";\n".
"\$db_passwd = \"nabu-3\";\n".
"\$db_host = \"localhost:3306\";\n".
"\$db_schema = \"nabu-3\";\n".
|
php
|
{
"resource": ""
}
|
q3553
|
CNabuEngine.getMainDB
|
train
|
public function getMainDB()
{
if ($this->main_database === null &&
($this->isOperationModeCLI() || $this->isOperationModeStandalone())
) {
|
php
|
{
"resource": ""
}
|
q3554
|
CNabuEngine.setMainDB
|
train
|
public function setMainDB(INabuDBConnector $connector)
{
if ($this->isInstallMode()) {
if ($this->main_database === null) {
$this->main_database = $connector;
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_MAIN_DB_ALREADY_EXISTS);
|
php
|
{
"resource": ""
}
|
q3555
|
CNabuEngine.traceLog
|
train
|
public function traceLog($key, $message)
{
if ($this->nb_error_handler) {
|
php
|
{
"resource": ""
}
|
q3556
|
CNabuEngine.triggerError
|
train
|
public function triggerError($error_message = null, $error_type = null) {
if ($error_message
|
php
|
{
"resource": ""
}
|
q3557
|
CNabuEngine.runApplication
|
train
|
public function runApplication($class_name)
{
$this->traceLog('Request timestamp', $this->microtime_start);
try {
switch (self::$operation_mode) {
case self::ENGINE_MODE_STANDALONE:
$this->locateHTTPServer();
$this->createBuiltInServer();
$this->createBuiltInSite();
break;
case self::ENGINE_MODE_HOSTED:
$this->registerMainDatabase();
$this->locateHTTPServer();
$this->createBuiltInServer();
$this->locateRunningConfiguration();
break;
case self::ENGINE_MODE_CLUSTERED:
$this->registerMainDatabase();
$this->locateHTTPServer();
$this->locateRunningConfiguration();
break;
default:
}
$retval = forward_static_call(array($class_name, 'launch'));
} catch (Exception
|
php
|
{
"resource": ""
}
|
q3558
|
CNabuEngine.callLocateHTTPServerHook
|
train
|
private function callLocateHTTPServerHook()
{
if (is_string(self::$locateHTTPServerHook)) {
${self::$locateHTTPServerHook}($this->nb_http_server);
}
|
php
|
{
"resource": ""
}
|
q3559
|
CNabuEngine.locateHTTPServer
|
train
|
private function locateHTTPServer()
{
$this->nb_http_server = null;
if (self::isCLIEnvironment()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_NOT_AVAILABLE, array(__METHOD__));
} elseif ($this->nb_http_server === null) {
$this->getHTTPServerPoolManager();
$this->nb_provider_factory
->getInterfaceDescriptors(CNabuProviderFactory::INTERFACE_HTTP_SERVER_SERVICE)
->iterate(function(string $key, CNabuHTTPServerInterfaceDescriptor $descriptor) {
$nb_factory = $this->nb_http_server_pool_manager->getHTTPServerFactory($descriptor);
$nb_interface = $nb_factory->getInterface();
if ($nb_interface
|
php
|
{
"resource": ""
}
|
q3560
|
CNabuEngine.createBuiltInServer
|
train
|
private function createBuiltInServer()
{
$nb_server = new CNabuBuiltInServer();
$nb_server_host = new CNabuBuiltInServerHost();
$host_path = $this->nb_http_server->getHostBaseDirectory();
$server_path = dirname($host_path);
|
php
|
{
"resource": ""
}
|
q3561
|
CNabuEngine.createBuiltInSite
|
train
|
private function createBuiltInSite()
{
$this->nb_customer = new CNabuBuiltInCustomer();
$nb_site = new CNabuBuiltInSite();
$nb_site_alias = new CNabuBuiltInSiteAlias();
$nb_domain_zone = new CNabuBuiltInDomainZone();
$nb_domain_zone_host = new CNabuBuiltInDomainZoneHost();
$server_name = $this->nb_http_server->getServerName();
$sname_parts = preg_split('/\\./', $server_name, 2);
if (count($sname_parts) === 2) {
list($host, $domain) = $sname_parts;
} elseif (count($sname_parts) === 1) {
$host = $sname_parts[0];
$domain = '';
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_DOMAIN_ZONE_NOT_FOUND);
}
$nb_domain_zone->setName($domain);
$nb_domain_zone_host->setName($host);
|
php
|
{
"resource": ""
}
|
q3562
|
CNabuEngine.getPHPIncludeFolders
|
train
|
public function getPHPIncludeFolders()
{
if (!is_array($this->framework_folders)) {
$this->framework_folders = array();
if (is_dir(NABU_SRC_PATH)) {
$this->framework_folders[] = realpath(NABU_SRC_PATH);
}
if (is_dir(NABU_SDK_PATH)) {
$this->framework_folders[] = realpath(NABU_SDK_PATH);
}
if (is_dir(NABU_PUB_PATH)) {
$this->framework_folders[] = realpath(NABU_PUB_PATH);
}
if (is_dir(NABU_LIB_PATH)) {
|
php
|
{
"resource": ""
}
|
q3563
|
CNabuEngine.getProviderManager
|
train
|
public function getProviderManager(string $vendor_key, string $module_key)
{
if ($this->nb_provider_factory instanceof CNabuProviderFactory) {
return $this->nb_provider_factory->getManager($vendor_key, $module_key);
} else {
|
php
|
{
"resource": ""
}
|
q3564
|
CNabuEngine.getProviderInterfaceDescriptor
|
train
|
public function getProviderInterfaceDescriptor(string $vendor, string $module, int $interface_type, string
|
php
|
{
"resource": ""
}
|
q3565
|
CNabuEngine.getProviderInterfaceDescriptorByKey
|
train
|
public function getProviderInterfaceDescriptorByKey(int $interface_type, string $interface_key)
{
|
php
|
{
"resource": ""
}
|
q3566
|
CNabuDataObjectListIndexLanguage.extractNodes
|
train
|
protected function extractNodes(CNabuDataObject $item)
{
$retval = null;
if ($item instanceof INabuTranslated) {
if ($item->hasTranslations()) {
$nodes = array();
$main_index_name = $this->list->getIndexedFieldName();
$item->getTranslations()->iterate(
function ($key, $translation) use (&$nodes, $main_index_name, $item) {
if (($translation->isValueNumeric($main_index_name) ||
$translation->isValueGUID($main_index_name)
) &&
($translation->isValueString($this->key_field) ||
$translation->isValueNumeric($this->key_field)
)
) {
$key = $translation->getValue($this->key_field);
$nodes[$key] = array(
'key' => $key,
'pointer' => $translation->getValue($main_index_name)
);
if ($translation->isValueNumeric($this->order_field) ||
$translation->isValueString($this->order_field)
) {
$nodes[$key]['order'] = $translation->getValue($this->order_field);
} elseif ($item->isValueNumeric($this->order_field)
|
php
|
{
"resource": ""
}
|
q3567
|
CNabuMessagingServiceTemplate.getTemplatesForService
|
train
|
public static function getTemplatesForService($nb_messaging_service) : CNabuMessagingServiceTemplateList
{
if (is_numeric($nb_messaging_service_id = nb_getMixedValue($nb_messaging_service, NABU_MESSAGING_SERVICE_FIELD_ID))) {
$retval = CNabuMessagingServiceTemplate::buildObjectListFromSQL(
'nb_messaging_template_id',
'select * '
. 'from nb_messaging_service_template '
. 'where nb_messaging_service_id=%service_id$d',
array(
'service_id' => $nb_messaging_service_id
|
php
|
{
"resource": ""
}
|
q3568
|
ScanHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $scans)
{
$hydrated = [];
foreach ($scans as $scan) {
|
php
|
{
"resource": ""
}
|
q3569
|
TNabuRoleMaskList.applyRoleMask
|
train
|
public function applyRoleMask(CNabuRole $nb_role, array $additional = null)
{
$total = $this->getSize();
$count = 0;
$this->iterate(function($key, INabuRoleMask $item) use($count, $nb_role, $additional) {
|
php
|
{
"resource": ""
}
|
q3570
|
CNabuIContactLanguageBase.setIcontactId
|
train
|
public function setIcontactId(int $nb_icontact_id) : CNabuDataObject
{
if ($nb_icontact_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3571
|
LicenseHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $licenses)
{
$hydrated = [];
foreach ($licenses as $license) {
|
php
|
{
"resource": ""
}
|
q3572
|
LicenseHydrator.hydrate
|
train
|
public static function hydrate(stdClass $license)
{
$hydrated = new LicenseEntity();
if (isset($license->id)) {
$hydrated->setId($license->id);
}
if (isset($license->created_at)) {
$hydrated->setCreatedAt(new DateTime($license->created_at));
}
if (isset($license->valid_until)) {
$hydrated->setValidUntil(new DateTime($license->valid_until));
}
if (isset($license->quota_distributed)) {
$hydrated->setQuotaDistributed($license->quota_distributed);
}
if (isset($license->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($license->created_by));
}
|
php
|
{
"resource": ""
}
|
q3573
|
CNabuCustomerUserBase.setUserId
|
train
|
public function setUserId(int $nb_user_id) : CNabuDataObject
{
if ($nb_user_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3574
|
CNabuCatalogTaxonomyLanguageBase.setCatalogTaxonomyId
|
train
|
public function setCatalogTaxonomyId(int $nb_catalog_taxonomy_id) : CNabuDataObject
{
if ($nb_catalog_taxonomy_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3575
|
OrgService.getAll
|
train
|
public function getAll(array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3576
|
OrgService.getById
|
train
|
public function getById($orgId, array $queryParams = [])
{
$response = $this->api->orgs()->getById($orgId,
|
php
|
{
"resource": ""
}
|
q3577
|
OrgService.update
|
train
|
public function update($orgId, OrgBuilder $input, array $queryParams = [])
{
$response = $this->api->orgs()->update($orgId,
|
php
|
{
"resource": ""
}
|
q3578
|
OrgService.deleteAll
|
train
|
public function deleteAll(array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3579
|
OrgService.deleteById
|
train
|
public function deleteById($orgId, array $queryParams = [])
{
$response = $this->api->orgs()->deleteById($orgId,
|
php
|
{
"resource": ""
}
|
q3580
|
CNabuSiteLanguageBase.setEnabled
|
train
|
public function setEnabled(string $enabled = "T") : CNabuDataObject
{
if ($enabled === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3581
|
CNabuSiteLanguageBase.setTranslationStatus
|
train
|
public function setTranslationStatus(string $translation_status = "D") : CNabuDataObject
{
if ($translation_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3582
|
CNabuSiteLanguageBase.setEditable
|
train
|
public function setEditable(string $editable = "F") : CNabuDataObject
{
if ($editable === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3583
|
ZendCacheConnector.normalizeKey
|
train
|
protected function normalizeKey($cacheId)
{
$cacheId = parent::normalizeKey($cacheId);
if (($pattern = $this->cache->getOptions()->getKeyPattern())
&& !preg_match($pattern, $cacheId)
) {
|
php
|
{
"resource": ""
}
|
q3584
|
ZendCacheConnector.flush
|
train
|
public function flush()
{
if (!($this->cache instanceof FlushableInterface)) {
return false;
}
try {
return $this->cache->flush();
|
php
|
{
"resource": ""
}
|
q3585
|
CNabuMediotecaLanguageBase.setMediotecaId
|
train
|
public function setMediotecaId(int $nb_medioteca_id) : CNabuDataObject
{
if ($nb_medioteca_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3586
|
Data.findOne
|
train
|
public function findOne(){
foreach($this->data as $k=>$v){
$key = $k;
break;
}
if(is_array($this->data[$key])){
|
php
|
{
"resource": ""
}
|
q3587
|
Data.findByKey
|
train
|
public function findByKey($rule){
$r = [];
foreach($this->data as $k=>$v){
if($rule($k)){
|
php
|
{
"resource": ""
}
|
q3588
|
Data.sort
|
train
|
public function sort($rule, $algorithm = "DefaultSort"){
$class = "\\NonDB\\Sorter\\" . $algorithm;
if(!class_exists($class) || !( \NonDB\Components\Tool::checkImplement($class, "NonDB\\Interfaces\\Sorter") )){
throw new \NonDB\Exceptions\DataException("Sorter $class didn't exists.", "0011");
return false;
|
php
|
{
"resource": ""
}
|
q3589
|
ClientHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $clients)
{
$hydrated = [];
foreach ($clients as $client) {
|
php
|
{
"resource": ""
}
|
q3590
|
ClientHydrator.hydrate
|
train
|
public static function hydrate(stdClass $client)
{
$hydrated = new ClientEntity();
if (isset($client->id)) {
$hydrated->setId($client->id);
}
if (isset($client->name)) {
$hydrated->setName($client->name);
}
if (isset($client->random_id)) {
$hydrated->setRandomId($client->random_id);
}
if (isset($client->secret)) {
$hydrated->setSecret($client->secret);
}
if (isset($client->allowed_grant_types)) {
|
php
|
{
"resource": ""
}
|
q3591
|
CNabuCatalogBase.getAllCatalogs
|
train
|
public static function getAllCatalogs(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_catalog_id',
'select * '
. 'from nb_catalog '
. 'where
|
php
|
{
"resource": ""
}
|
q3592
|
TNabuCatalogChild.getCatalog
|
train
|
public function getCatalog($force = false)
{
if ($this->nb_catalog === null || $force) {
$this->nb_catalog = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_CATALOG_FIELD_ID)
) {
|
php
|
{
"resource": ""
}
|
q3593
|
TNabuCatalogChild.setCatalog
|
train
|
public function setCatalog(CNabuCatalog $nb_catalog)
{
$this->nb_catalog = $nb_catalog;
if ($this instanceof CNabuDataObject
|
php
|
{
"resource": ""
}
|
q3594
|
CNabuProviderFactory.getFactory
|
train
|
public static function getFactory()
{
if (self::$nb_provider_factory === null) {
self::$nb_provider_factory =
|
php
|
{
"resource": ""
}
|
q3595
|
CNabuProviderFactory.scanProvidersFolder
|
train
|
public function scanProvidersFolder()
{
$folders = array();
$this->scanVendorFolders($folders);
if (count($folders) > 0) {
foreach ($folders as $provider) {
try {
nb_requireOnceIsolated($provider, true, true);
} catch (Exception $ex) {
throw new ENabuProviderException(
|
php
|
{
"resource": ""
}
|
q3596
|
CNabuProviderFactory.scanVendorFolders
|
train
|
private function scanVendorFolders(&$folders)
{
$basedir = realpath(NABU_PROVIDERS_PATH);
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($folder = readdir($h))) {
if ($folder !== '.' && $folder !== '..') {
|
php
|
{
"resource": ""
}
|
q3597
|
CNabuProviderFactory.scanModuleFolders
|
train
|
private function scanModuleFolders($basedir, &$folders)
{
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($folder = readdir($h))) {
if ($folder !== '.' && $folder !== '..') {
|
php
|
{
"resource": ""
}
|
q3598
|
CNabuProviderFactory.scanModuleFiles
|
train
|
private function scanModuleFiles($basedir, &$folders)
{
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($filename = readdir($h))) {
$phpfile = $basedir . DIRECTORY_SEPARATOR . $filename;
|
php
|
{
"resource": ""
}
|
q3599
|
CNabuProviderFactory.addManager
|
train
|
public function addManager(INabuProviderManager $nb_manager)
{
$vendor_key = $nb_manager->getVendorKey();
if (nb_isValidKey($vendor_key)) {
$module_key = $nb_manager->getModuleKey();
if (!nb_isValidKey($module_key)) {
throw new ENabuProviderException(
ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID,
array($module_key)
);
}
} else {
throw new ENabuProviderException(
ENabuProviderException::ERROR_VENDOR_KEY_NOT_VALID,
array($vendor_key)
);
}
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.