_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q3400
CNabuSiteRoleBase.setLoginRedirectionTargetUseURI
train
public function setLoginRedirectionTargetUseURI($login_redirection_target_use_uri) : CNabuDataObject { if ($login_redirection_target_use_uri === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3401
CNabuSiteRoleBase.setPoliciesTargetUseURI
train
public function setPoliciesTargetUseURI($policies_target_use_uri) : CNabuDataObject { if ($policies_target_use_uri === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3402
CNabuUserGroupLanguageBase.setUserGroupId
train
public function setUserGroupId(int $nb_user_group_id) : CNabuDataObject { if ($nb_user_group_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3403
CNabuUserGroupLanguageBase.setTitle
train
public function setTitle(string $title) : CNabuDataObject { if ($title === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$title")
php
{ "resource": "" }
q3404
CNabuCommerceProduct.getProductsForCommerce
train
static public function getProductsForCommerce($nb_commerce) { $nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID); if (is_numeric($nb_commerce_id)) { $retval = CNabuCommerceProduct::buildObjectListFromSQL( 'nb_commerce_product_id', 'SELECT * FROM nb_commerce_product WHERE nb_commerce_id=%commerce_id$d', array( 'commerce_id' => $nb_commerce_id
php
{ "resource": "" }
q3405
CNabuCommerceProduct.findBySKU
train
static public function findBySKU($nb_commerce, string $sku) { $retval = false; $nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID); if (is_numeric($nb_commerce_id)) { $retval = CNabuCommerceProduct::buildObjectFromSQL( 'SELECT * from nb_commerce_product where nb_commerce_id=%commerce_id$d
php
{ "resource": "" }
q3406
CNabuUser.setEmail
train
public function setEmail(string $email) : CNabuDataObject {
php
{ "resource": "" }
q3407
CNabuUser.activate
train
public function activate(bool $save = false) : bool { $retval = false; $current = $this->getValidationStatus(); if ($current === self::USER_VALIDATION_PENDING || $current === self::USER_VALIDATION_PENDING_WITH_INVITATION) { $this->setActivationDatetime(date('Y-m-d H:i:s', time()));
php
{ "resource": "" }
q3408
CNabuUser.findByStaticEncodedId
train
public static function findByStaticEncodedId($nb_customer, string $key) { $retval = null; if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) && strlen($key) > 0 ) { $retval = CNabuUser::buildObjectFromSQL( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'", array(
php
{ "resource": "" }
q3409
CNabuUser.findByStaticEncodedLogin
train
public static function findByStaticEncodedLogin($nb_customer, string $key) { $retval = null; if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) && strlen($key) > 0 ) { $retval = CNabuUser::buildObjectFromSQL( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_login, '%suff\$s'))='%key\$s'", array(
php
{ "resource": "" }
q3410
CNabuUser.findByTemporalEncodedId
train
public static function findByTemporalEncodedId($nb_customer, string $key, int $expires = NABU_TEMP_ENC_ID_EXPIRATION_TIME) { $retval = null; if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) && strlen($key) > 0 ) { $hash_left = $hash_time = null; sscanf($key, "%32s%x", $hash_left, $hash_time); if ($hash_time >= time()) { $retval = CNabuUser::buildObjectFromSQL( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'", array(
php
{ "resource": "" }
q3411
CNabuUser.findBySiteLogin
train
static public function findBySiteLogin($nb_site, $login, $passwd, $active = true) { $retval = null; $nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id'); if (is_numeric($nb_site_id)) { $retval = CNabuUser::buildObjectFromSQL( "select u.*, su.nb_role_id " . "from nb_user u, nb_site_user su " . "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) " . "and u.nb_user_passwd='%passwd\$s' " . ($active ? "and u.nb_user_validation_status='T' " : '')
php
{ "resource": "" }
q3412
CNabuUser.findByEMail
train
static public function findByEMail($nb_customer, string $email) { $retval = null; if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID))) { $retval = CNabuUser::buildObjectFromSQL( 'select u.* ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . 'and u.nb_user_email=\'%email$s\'', array(
php
{ "resource": "" }
q3413
CNabuUser.getPrescriber
train
public function getPrescriber(bool $force = false) { if ($this->nb_prescriber == NULL || $this->nb_prescriber->getId() != $this->getPrescriberId() || $force ) { $nb_prescriber_id = $this->getPrescriberId(); if ($nb_prescriber_id === null || $this->getCustomer() === null) {
php
{ "resource": "" }
q3414
CallbackHydrator.hydrateCollection
train
public static function hydrateCollection(array $callbacks) { $hydrated = []; foreach ($callbacks as $callback) {
php
{ "resource": "" }
q3415
CallbackHydrator.hydrate
train
public static function hydrate(stdClass $callback) { $hydrated = new CallbackEntity(); if (isset($callback->id)) { $hydrated->setId($callback->id); } if (isset($callback->internal)) { $hydrated->setInternal($callback->internal); } if (isset($callback->observe_organization)) { $hydrated->setObserveOrganization($callback->observe_organization); } if (isset($callback->url)) { $hydrated->setUrl($callback->url); } if (isset($callback->reports) && is_array($callback->reports)) { $hydrated->setReports($callback->reports); } if (isset($callback->created_at)) { $hydrated->setCreatedAt(new DateTime($callback->created_at)); } if (isset($callback->created_by)) {
php
{ "resource": "" }
q3416
TNabuSiteRoleMask.isForPublicZone
train
public function isForPublicZone(bool $strict = false) { if (!method_exists($this, 'getZone')) { throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED); }
php
{ "resource": "" }
q3417
TNabuSiteRoleMask.isForPrivateZone
train
public function isForPrivateZone(bool $strict = false) { if (!method_exists($this, 'getZone')) { throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED); }
php
{ "resource": "" }
q3418
TNabuSiteRoleMask.isForBothZones
train
public function isForBothZones() { if (!method_exists($this, 'getZone')) { throw
php
{ "resource": "" }
q3419
TNabuSiteRoleMask.isZoneHidden
train
public function isZoneHidden() { if (!method_exists($this, 'getZone')) { throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
php
{ "resource": "" }
q3420
TNabuHashed.grantHash
train
public function grantHash(bool $save = false) : string { if (!nb_isValidGUID($hash = $this->getHash())) { $this->setHash($hash = nb_generateGUID());
php
{ "resource": "" }
q3421
UserHydrator.hydrateCollection
train
public static function hydrateCollection(array $users) { $hydrated = []; foreach ($users as $user) {
php
{ "resource": "" }
q3422
UserHydrator.hydrate
train
public static function hydrate(stdClass $user) { $hydrated = new UserEntity(); if (isset($user->id)) { $hydrated->setId($user->id); } if (isset($user->email)) { $hydrated->setEmail($user->email); } if (isset($user->firstname)) { $hydrated->setFirstname($user->firstname); } if (isset($user->lastname)) { $hydrated->setLastname($user->lastname); } if (isset($user->valid_until)) { $hydrated->setValidUntil(new DateTime($user->valid_until));
php
{ "resource": "" }
q3423
UrlGenerator.replaceRouteParameters
train
protected function replaceRouteParameters($route, &$parameters = []) { return \preg_replace_callback('/\{(.*?)(:.*?)?(\{[0-9,]+\})?\}/', function ($m) use (&$parameters) { return
php
{ "resource": "" }
q3424
CNabuSiteMapRole.getMapRolesForSite
train
static public function getMapRolesForSite($nb_site) { $nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID); if (is_numeric($nb_site_id)) { $retval = CNabuEngine::getEngine() ->getMainDB() ->getQueryAsObjectArray( '\nabu\data\site\CNabuSiteMapRole', null,
php
{ "resource": "" }
q3425
CommentHydrator.hydrateCollection
train
public static function hydrateCollection(array $comments) { $hydrated = []; foreach ($comments as $comment) {
php
{ "resource": "" }
q3426
CommentHydrator.hydrate
train
public static function hydrate(stdClass $comment) { $hydrated = new CommentEntity(); if (isset($comment->id)) { $hydrated->setId($comment->id); } if (isset($comment->comment)) { $hydrated->setComment($comment->comment); } if (isset($comment->created_at)) {
php
{ "resource": "" }
q3427
CNabuCatalogItemTagBase.setCatalogItemId
train
public function setCatalogItemId(int $nb_catalog_item_id) : CNabuDataObject { if ($nb_catalog_item_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3428
LdapService.get
train
public function get(array $queryParams = []) { $response
php
{ "resource": "" }
q3429
LdapService.update
train
public function update(LdapBuilder $input, array $queryParams = []) { $response = $this->api->systems()->ldap()->update($input->toArray(),
php
{ "resource": "" }
q3430
LdapService.sync
train
public function sync(array $queryParams = []) { $response
php
{ "resource": "" }
q3431
SettingService.getAll
train
public function getAll(array $queryParams = []) { $response = $this->api->settings()->getAll($queryParams);
php
{ "resource": "" }
q3432
SettingService.createOrUpdate
train
public function createOrUpdate($key, SettingBuilder $input, array $queryParams = []) { $response = $this->api->settings()->createOrUpdate($key,
php
{ "resource": "" }
q3433
SettingService.deleteAll
train
public function deleteAll(array $queryParams = []) { $response
php
{ "resource": "" }
q3434
CNabuErrorHandler.errorHandler
train
public function errorHandler(int $errno, string $errstr, string $errfile, string $errline, array
php
{ "resource": "" }
q3435
CNabuErrorHandler.dumpStack
train
public function dumpStack( string $message = null, string $type = null, string $errfile = null, int $errline = null, $errcontext = null, array $stack = null ) { global $NABU_MESSAGE_TYPE_NAME; if (($errtype = nb_getArrayValueByKey($type, $NABU_MESSAGE_TYPE_NAME)) === null) { $this->nb_engine->errorLog("Unknow error type [$type]: $message in $errfile [line:$errline]"); } else { $this->nb_engine->errorLog("$errtype: $message in $errfile [line:$errline]"); } if ($stack === null) { $stack = debug_backtrace(true); } $count = -1; do { foreach ($stack as $line) { if ($count < 0 && (!array_key_exists('file', $line) || !array_key_exists('line', $line) || $line['file'] !== $errfile || $line['line'] !== $errline ) ) { continue; } elseif (array_key_exists('file', $line) && $line['file'] === $errfile && $line['line'] === $errline ) { $count++; continue; } $source = ''; if (array_key_exists(self::LINE_CLASS, $line)) { $source .= $line[self::LINE_CLASS]; } if (array_key_exists('type', $line)) { $source .= $line['type']; } if (array_key_exists(self::LINE_FUNCTION, $line)) {
php
{ "resource": "" }
q3436
CNabuErrorHandler.traceLog
train
public function traceLog(string $key = null, $message = null) { if ($this->trace_log_enabled) { if (is_array($message) || is_object($message)) { $text = print_r($message, true); } elseif ($message === null) { $text = "[null]"; } elseif ($message === false) { $text = "[false]"; } elseif ($message === true) { $text = "[true]"; } else { $text = $message; } error_log("=== " . ($key !== null ? "$key: " : '') . $text); } if ($key === null) { if ($this->trace_log_buffer === null) { $this->trace_log_buffer = array(); }
php
{ "resource": "" }
q3437
AutoUuid.bootAutoUuid
train
protected static function bootAutoUuid() { static::creating(function ($model) { foreach($model->getAutoUuids() as $autoUuid) { if (empty($model->{$autoUuid})) {
php
{ "resource": "" }
q3438
ApplicationService.getById
train
public function getById($appId, array $queryParams = []) { $response = $this->api->applications()->getById($appId,
php
{ "resource": "" }
q3439
ApplicationService.update
train
public function update($appId, ApplicationBuilder $input, array $queryParams = []) { $response
php
{ "resource": "" }
q3440
ApplicationService.deleteAll
train
public function deleteAll(array $queryParams = []) { $response
php
{ "resource": "" }
q3441
Historable.writeHistory
train
public function writeHistory($action, $title = null, array $old = [], array $new = []) { $data['historable_id'] = $this->getKey(); $data['historable_type'] = get_class($this); $data['user_id'] = auth()->id();
php
{ "resource": "" }
q3442
EditLayoutCompiler.compile
train
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra =
php
{ "resource": "" }
q3443
CNabuCatalogItemList.populate
train
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)
php
{ "resource": "" }
q3444
CNabuDBObject.getDescriptor
train
public function getDescriptor($force = false) { if (!($this->storage_descriptor instanceof INabuDBDescriptor) || $force) { $this->storage_descriptor = null;
php
{ "resource": "" }
q3445
CNabuDBObject.refresh
train
public function refresh(bool $force = false, bool $cascade =
php
{ "resource": "" }
q3446
CNabuSiteTargetBase.findByKey
train
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'",
php
{ "resource": "" }
q3447
CNabuSiteTargetBase.getAllSiteTargets
train
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
php
{ "resource": "" }
q3448
CNabuSiteTargetBase.setUseHTTP
train
public function setUseHTTP(string $use_http = "F") : CNabuDataObject { if ($use_http === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3449
CNabuSiteTargetBase.setUseHTTPS
train
public function setUseHTTPS(string $use_https = "F") : CNabuDataObject { if ($use_https === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3450
CNabuSiteTargetBase.setAttachment
train
public function setAttachment(string $attachment = "F") : CNabuDataObject { if ($attachment === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3451
CNabuSiteTargetBase.setSmartyDebugging
train
public function setSmartyDebugging(string $smarty_debugging = "F") : CNabuDataObject { if ($smarty_debugging === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3452
CNabuSiteTargetBase.setPHPTrace
train
public function setPHPTrace(string $php_trace = "F") : CNabuDataObject { if ($php_trace === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3453
CNabuSiteTargetBase.setIgnorePolicies
train
public function setIgnorePolicies(string $ignore_policies = "F") : CNabuDataObject { if ($ignore_policies === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3454
CNabuSiteTargetBase.setUseCommerce
train
public function setUseCommerce(string $use_commerce = "F") : CNabuDataObject { if ($use_commerce === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3455
CNabuSiteTargetBase.setUseApps
train
public function setUseApps(string $use_apps = "F") : CNabuDataObject { if ($use_apps === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3456
CNabuSiteTargetBase.setDynamicCacheControl
train
public function setDynamicCacheControl(string $dynamic_cache_control = "S") : CNabuDataObject { if ($dynamic_cache_control === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3457
CNabuMessagingTemplate.getActiveServices
train
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) {
php
{ "resource": "" }
q3458
CNabuMessagingServiceStackBase.getAllMessagingServiceStacks
train
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
php
{ "resource": "" }
q3459
CNabuMessagingServiceStackBase.setMessagingId
train
public function setMessagingId(int $nb_messaging_id) : CNabuDataObject { if ($nb_messaging_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3460
CNabuMessagingServiceStackBase.setMessagingServiceId
train
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,
php
{ "resource": "" }
q3461
CNabuMessagingServiceStackBase.setMessagingTemplateId
train
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,
php
{ "resource": "" }
q3462
CNabuProjectVersionBase.getAllProjectVersions
train
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
php
{ "resource": "" }
q3463
CNabuProjectVersionBase.getFilteredProjectVersionList
train
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 . ' ' : '* ')
php
{ "resource": "" }
q3464
CNabuProjectVersionBase.setProjectId
train
public function setProjectId(int $nb_project_id) : CNabuDataObject { if ($nb_project_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3465
LogHydrator.hydrateCollection
train
public static function hydrateCollection(array $logs) { $hydrated = []; foreach ($logs as $log) {
php
{ "resource": "" }
q3466
LogHydrator.hydrate
train
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)); }
php
{ "resource": "" }
q3467
PartHydrator.hydrateCollection
train
public static function hydrateCollection(array $parts) { $hydrated = []; foreach ($parts as $part) {
php
{ "resource": "" }
q3468
PartHydrator.hydrate
train
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);
php
{ "resource": "" }
q3469
EntityManager.insert
train
public function insert($entity) { $eloquentModel = $this->getEloquentModel($entity);
php
{ "resource": "" }
q3470
EntityManager.update
train
public function update($entity) { $eloquentModel = $this->getEloquentModel($entity, true); $this->updateRelations($eloquentModel, 'update');
php
{ "resource": "" }
q3471
EntityManager.updateRelations
train
protected function updateRelations($eloquentModel, $action) { $mapping = $eloquentModel->getMapping(); $eloquentRelations = $eloquentModel->getRelations(); foreach($mapping['relations'] as $name => $relationMapping) {
php
{ "resource": "" }
q3472
EntityManager.updateRelation
train
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
php
{ "resource": "" }
q3473
EntityManager.updateBelongsToRelation
train
protected function updateBelongsToRelation($eloquentModel, $name, $action) { if ($action == 'insert' || $action == 'update') {
php
{ "resource": "" }
q3474
EntityManager.updateBelongsToManyRelation
train
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(); }
php
{ "resource": "" }
q3475
ContextService.getAll
train
public function getAll($appId, $scanId, $issueId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues()
php
{ "resource": "" }
q3476
ContextService.getById
train
public function getById($appId, $scanId, $issueId, $contextId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues()
php
{ "resource": "" }
q3477
GraphBuilder.getResults
train
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, ''));
php
{ "resource": "" }
q3478
GraphBuilder.parseRelationsFromSchema
train
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]))
php
{ "resource": "" }
q3479
GraphBuilder.schema
train
public function schema(array $schema) { $this->root = key($schema);
php
{ "resource": "" }
q3480
ResourceHydrator.hydrateCollection
train
public static function hydrateCollection(array $resources) { $hydrated = []; foreach ($resources as $resource) {
php
{ "resource": "" }
q3481
ResourceHydrator.hydrate
train
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)) {
php
{ "resource": "" }
q3482
CNabuSiteAliasBase.getAllSiteAliass
train
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
php
{ "resource": "" }
q3483
CNabuSiteAliasBase.setDomainZoneHostId
train
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,
php
{ "resource": "" }
q3484
CNabuSiteAliasBase.setType
train
public function setType(string $type = "F") : CNabuDataObject { if ($type === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$type")
php
{ "resource": "" }
q3485
TypeHydrator.hydrateCollection
train
public static function hydrateCollection(array $types) { $hydrated = []; foreach ($types as $type) {
php
{ "resource": "" }
q3486
CNabuSiteVisualEditorItemBase.setVRId
train
public function setVRId(string $vr_id) : CNabuDataObject { if ($vr_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$vr_id")
php
{ "resource": "" }
q3487
Model.toDatamapperObject
train
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 ); }
php
{ "resource": "" }
q3488
Model.setProperty
train
protected function setProperty(&$reflectionClass, $entity, $name, $value) { $property = $reflectionClass->getProperty($name);
php
{ "resource": "" }
q3489
Model.toDataTransferObject
train
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);
php
{ "resource": "" }
q3490
Model.newFromDatamapperObject
train
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); }
php
{ "resource": "" }
q3491
Model.isAutomaticallyUpdatedDate
train
public function isAutomaticallyUpdatedDate($attribute) { // soft deletes if (in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses(static::class)) && $attribute == $this->getDeletedAtColumn()) { return true; } // timestamps
php
{ "resource": "" }
q3492
Model.getProperty
train
protected function getProperty($reflectionObject, $entity, $name) { $property = $reflectionObject->getProperty($name);
php
{ "resource": "" }
q3493
Model.getColumnName
train
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']
php
{ "resource": "" }
q3494
CNabuMediotecasManager.getMedioteca
train
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)
php
{ "resource": "" }
q3495
CNabuMediotecasManager.getMediotecas
train
public function getMediotecas($force = false) { if ($this->nb_medioteca_list->isEmpty() || $force) { $this->nb_medioteca_list->merge(
php
{ "resource": "" }
q3496
TNabuTranslated.getLanguage
train
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();
php
{ "resource": "" }
q3497
TNabuTranslated.setLanguage
train
public function setLanguage(CNabuLanguage $nb_language) { if ($nb_language->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_language->isValueGUID(NABU_LANG_FIELD_ID)) {
php
{ "resource": "" }
q3498
TNabuTranslated.getTranslation
train
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();
php
{ "resource": "" }
q3499
TNabuTranslated.hasTranslations
train
public function hasTranslations(bool $force = false) { $this->getTranslations($force);
php
{ "resource": "" }