加锁语句

@return string
761222
protected function getLockString(): string
    {
        $statement = '';
        $locks = $this->builder->getLocks();
        if (! $locks || ! $this->isSelect()) {
            return $statement;
        }
        if (isset($locks['for_update']) && $locks['for_update'] === true) {
            $statement = 'FOR UPDATE';
        } elseif (isset($locks['shared_lock']) && $locks['shared_lock'] === true) {
            $statement = 'LOCK IN SHARE MODE';
        }

        return $statement;
    }
1020686
private function startCommon(): void
    {
        if (self::$app !== null) {
            return;
        }
        self::$app = $this;
        // 加载框架配置文件
        $config = DataMap::loadFromPhpFile($this->mvcSourcePath . '/../config.inc.php');
        // 应用配置
        if ($this->config === null) {
            $appConfigFile = APP_CONFIG_PATH . '/./config.inc.php';
            if (is_file($appConfigFile)) {
                $appConfig = DataMap::loadFromPhpFile($appConfigFile);
                $config->mergeData($appConfig);
            }
        } else {
            $config->mergeData($this->config);
        }
        $this->config = $config;
        $this->loadContainer();
    }
754698
public function add()
    {
        $entity = $this->Dblists->newEntity();
        if ($this->request->is('post')) {
            $entity = $this->Dblists->patchEntity($entity, (array)$this->request->getData());
            if ($this->Dblists->save($entity)) {
                $this->Flash->success('The database list has been saved.');

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error('The database list could not be saved. Please, try again.');
        }

        $this->set(compact('entity'));
        $this->set('_serialize', ['entity']);
    }
1011144
public function load()
    {
        $this->extensions = [];
        foreach ($this->getPackages() as $package) {
            [$v, $p] = explode('/', $package['name']);
            $extension = Extension::findBy([
                'vendor' => $v,
                'package' => $p
            ]);
            if (!$extension) {
                $extension = (new Extension())
                    ->vendor($v)
                    ->package($p);
            }
            $extension
                ->version($package['version'] ?? '')
                ->description($package['description'] ?? '')
                ->save();
            $this->extensions[] = $extension;
        }
        return $this;
    }
1309688
public function add() {
        $task = $this->Tasks->newEntity();
        if ($this->request->is('post')) {
            $task = $this->Tasks->patchEntity($task, $this->request->data);
            if ($this->Tasks->save($task)) {
                $this->Flash->success(__('The task has been saved.'));
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('The task could not be saved. Please, try again.'));
            }
        }
        $this->set(compact('task'));
        $this->set('_serialize', ['task']);
        $this->filteredSelectOptions();
    }
696757
public function add()
    {
        $table = $this->loadModel();

        $entity = $table->newEntity();

        if ($this->request->is('post')) {
            $post_data = $this->request->getParam(
                'data',
                (array)$this->request->getData()
            );

            $response = $this->persistEntity($entity, $post_data);
            if ($response) {
                $this->saveAssociations($entity, $post_data);

                return $response;
            }
        }

        $this->set('entity', $entity);
        $this->render('CsvMigrations.Common/add');
        $this->set('_serialize', ['entity']);
    }
261375
public function add()
    {
        $this->request->allowMethod(['post', 'patch', 'put']);
        $response = [
            'success' => false,
            'data' => [],
            'errors' => [],
        ];

        $calendarsTable = TableRegistry::get('Calendars');

        $data = $this->request->getData();
        $data = is_array($data) ? $data : [];
        if (empty($data['calendar_id'])) {
            $response['errors'][] = "Calendar ID is missing";
            $this->set(compact('response'));
            $this->set('_serialize', 'response');

            return $this->response;
        }

        $calendar = $calendarsTable->get($data['calendar_id']);
        $postData = $this->CalendarEvents->setCalendarEventData($data, $calendar);

        $calendarEvent = $this->CalendarEvents->newEntity();
        $calendarEvent = $this->CalendarEvents->patchEntity(
            $calendarEvent,
            $postData,
            [
                'associated' => ['CalendarAttendees'],
            ]
        );

        $saved = $this->CalendarEvents->save($calendarEvent);

        if ($saved) {
            $response['success'] = true;
            $response['data'] = $this->CalendarEvents->getEventInfo($saved->id, $calendar);
        } else {
            $response['errors'] = $calendarEvent->getErrors();
        }

        $this->set(compact('response'));
        $this->set('_serialize', 'response');
    }
364432
public function add()
    {
        $this->loadModel('Menu.Menus');
        $menu = $this->Menus->newEntity();

        if ($this->request->data()) {
            $data = $this->request->data();
            $data['handler'] = 'Menu';
            $menu = $this->Menus->patchEntity($menu, $data, [
                'fieldList' => [
                    'title',
                    'handler',
                    'description',
                    'settings',
                ],
            ]);

            if ($this->Menus->save($menu, ['atomic' => true])) {
                $this->Flash->success(__d('menu', 'Menu has been created, now you can start adding links!'));
                $this->redirect(['plugin' => 'Menu', 'controller' => 'links', 'action' => 'add', $menu->id]);
            } else {
                $this->Flash->danger(__d('menu', 'Menu could not be created, please check your information'));
            }
        }

        $this->title(__d('menu', 'Create New Menu'));
        $this->set('menu', $menu);
        $this->Breadcrumb
            ->push('/admin/menu/manage')
            ->push(__d('menu', 'Creating new menu'), '#');
    }
349843
protected function loadDefaultStyles(): void
    {
        $this
            ->addByArray(self::NORMAL, ['fg' => 'normal'])
            // 不明显的 浅灰色的
            ->addByArray(self::FAINTLY, ['fg' => 'normal', 'options' => ['italic']])
            ->addByArray(self::BOLD, ['options' => ['bold']])
            ->addByArray(self::INFO, ['fg' => 'green',])//'options' => ['bold']
            ->addByArray(self::NOTE, ['fg' => 'cyan', 'options' => ['bold']])//'options' => ['bold']
            ->addByArray(self::PRIMARY, ['fg' => 'yellow', 'options' => ['bold']])//
            ->addByArray(self::SUCCESS, ['fg' => 'green', 'options' => ['bold']])
            ->addByArray(self::NOTICE, ['options' => ['bold', 'underscore'],])
            ->addByArray(self::WARNING, ['fg' => 'black', 'bg' => 'yellow',])//'options' => ['bold']
            ->addByArray(self::COMMENT, ['fg' => 'yellow',])//'options' => ['bold']
            ->addByArray(self::QUESTION, ['fg' => 'black', 'bg' => 'cyan'])
            ->addByArray(self::DANGER, ['fg' => 'red',])// 'bg' => 'magenta', 'options' => ['bold']
            ->add(self::ERROR, 'white', 'red', [], true)
            ->add('underline', 'normal', '', ['underscore'])
            ->add('blue', 'blue')
            ->add('cyan', 'cyan')
            ->add('magenta', 'magenta')
            ->add('mga', 'magenta')
            ->add('red', 'red')
            ->addByArray('yellow', ['fg' => 'yellow'])
            ->addByArray('darkGray', ['fg' => 'black', 'extra' => true]);
    }
757599
public function add() {
        global $CFG, $USER, $DB;

        unset($this->id);
        $this->module       = 'blog';
        $this->userid       = (empty($this->userid)) ? $USER->id : $this->userid;
        $this->lastmodified = time();
        $this->created      = time();

        // Insert the new blog entry.
        $this->id = $DB->insert_record('post', $this);

        if (!empty($CFG->useblogassociations)) {
            $this->add_associations();
        }

        core_tag_tag::set_item_tags('core', 'post', $this->id, context_user::instance($this->userid), $this->tags);

        // Trigger an event for the new entry.
        $event = \core\event\blog_entry_created::create(array(
            'objectid'      => $this->id,
            'relateduserid' => $this->userid
        ));
        $event->set_blog_entry($this);
        $event->trigger();
    }
479196
public function add()
    {
        $this->requireAdmin();

        $this->layout->title = Lang::get('add_user');

        $method = $this->request->getMethod();

        if ($method == 'POST') {
            $values = $this->getParams();
        } else {
            $values = array();
        }

        $form   = $this->userForm($values);

        if ($method != 'POST' || ($method == 'POST' && !$form->validate())) {
            $view           = new b8\View('UserForm');
            $view->type     = 'add';
            $view->user     = null;
            $view->form     = $form;

            return $view->render();
        }


        $name = $this->getParam('name', null);
        $email = $this->getParam('email', null);
        $password = $this->getParam('password', null);
        $isAdmin = (int)$this->getParam('is_admin', 0);

        $this->userService->createUser($name, $email, $password, $isAdmin);

        $response = new b8\Http\Response\RedirectResponse();
        $response->setHeader('Location', PHPCI_URL . 'user');
        return $response;
    }
1001378
public function add()
    {
        $language = $this->Languages->newEntity();
        if ($this->request->is('post')) {
            $data = is_array($this->request->getData()) ? $this->request->getData() : [];
            $languageEntity = $this->Languages->addOrRestore($data);
            if (!empty($languageEntity)) {
                $this->Flash->success((string)__('The language has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error((string)__('The language could not be saved. Please, try again.'));
        }
        $languages = $this->Languages->getAvailable();
        $this->set(compact('language', 'languages'));
        $this->set('_serialize', ['language']);
    }
915107
public function load()
    {
        // NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM!
        $grav = $this->grav;
        $config = $this->config;
        $name = $this->current();

        /** @var UniformResourceLocator $locator */
        $locator = $grav['locator'];
        $file = $locator('theme://theme.php') ?: $locator("theme://{$name}.php");

        $inflector = $grav['inflector'];

        if ($file) {
            // Local variables available in the file: $grav, $config, $name, $file
            $class = include $file;

            if (!is_object($class)) {
                $themeClassFormat = [
                    'Grav\\Theme\\' . ucfirst($name),
                    'Grav\\Theme\\' . $inflector->camelize($name)
                ];

                foreach ($themeClassFormat as $themeClass) {
                    if (class_exists($themeClass)) {
                        $themeClassName = $themeClass;
                        $class = new $themeClassName($grav, $config, $name);
                        break;
                    }
                }
            }
        } elseif (!$locator('theme://') && !defined('GRAV_CLI')) {
            exit("Theme '$name' does not exist, unable to display page.");
        }

        $this->config->set('theme', $config->get('themes.' . $name));

        if (empty($class)) {
            $class = new Theme($grav, $config, $name);
        }

        return $class;
    }
1194338
public function add()
    {
        $obj = new \CIBlockType();
        if (!$obj->Add($this->getFieldsWithDefault())) {
            throw new \Exception($obj->LAST_ERROR);
        }

        Logger::log("Добавлен тип инфоблока {$this->fields['ID']}", Logger::COLOR_GREEN);
    }
608435
public function loadConfig()
    {
        $fileName = File::path(dirname($this->getPath()), 'config/config.php');
        if(is_file($fileName))
        {
            Config::addConfig('@' . $this->moduleName, include $fileName);
        }
    }
503538
public function add()
    {
        $data = (array)$this->request->getData();
        if (!empty($data['group_id'])) {
            $data['owner_model'] = 'Groups';
            $data['owner_foreign_key'] = $data['group_id'];
        } elseif (!empty($data['user_id'])) {
            $data['owner_model'] = 'Users';
            $data['owner_foreign_key'] = $data['user_id'];
        } else {
            throw new InvalidArgumentException("Missing user or group!");
        }

        $data['creator'] = $this->Auth->user('id');
        $permission = $this->Permissions->newEntity();
        if ($this->request->is('post')) {
            $permission = $this->Permissions->patchEntity($permission, $data);
            $this->Permissions->save($permission) ?
                $this->Flash->success((string)__('The  permission has been saved.')) :
                $this->Flash->error((string)__('The  permission could not be saved. Please, try again.'));

            return $this->redirect($this->referer());
        }
        $users[''] = '';
        asort($users);
        $types[''] = '';
        foreach (PermissionsTable::ALLOWED_ACTIONS as $action) {
            $types[$action] = Inflector::humanize($action);
        }
        $this->set(compact('permission', 'users', 'types'));
        $this->set('_serialize', ['permission']);
    }
1081008
public function add() {
        $cmsContent = $this->CmsContent->newEntity();
        if ($this->request->is('post')) {
            $cmsContent = $this->CmsContent->patchEntity($cmsContent, $this->request->data);
            if ($this->CmsContent->save($cmsContent)) {
                $this->Flash->success('The cms content has been saved.');
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms content could not be saved. Please, try again.');
            }
        }
        $this->set(compact('cmsContent'));
        $this->set('_serialize', ['cmsContent']);
    }