• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Database\Database类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Drupal\Core\Database\Database的典型用法代码示例。如果您正苦于以下问题:PHP Database类的具体用法?PHP Database怎么用?PHP Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Database类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testNode

 /**
  * Test node migration from Drupal 6 to 8.
  */
 public function testNode()
 {
     $node = node_load(1);
     $this->assertEqual($node->id(), 1, 'Node 1 loaded.');
     $this->assertEqual($node->body->value, 'test');
     $this->assertEqual($node->body->format, 'filtered_html');
     $this->assertEqual($node->getType(), 'story', 'Node has the correct bundle.');
     $this->assertEqual($node->getTitle(), 'Test title', 'Node has the correct title.');
     $this->assertEqual($node->getCreatedTime(), 1388271197, 'Node has the correct created time.');
     $this->assertEqual($node->isSticky(), FALSE);
     $this->assertEqual($node->getOwnerId(), 1);
     //$this->assertEqual($node->getRevisionCreationTime(), 1390095701, 'Node has the correct revision timestamp.');
     // It is pointless to run the second half from MigrateDrupal6Test.
     if (empty($this->standalone)) {
         return;
     }
     // Test that we can re-import using the EntityContentBase destination.
     $connection = Database::getConnection('default', 'migrate');
     $connection->update('node_revisions')->fields(array('title' => 'New node title', 'format' => 2))->condition('vid', 1)->execute();
     $connection->delete('content_field_test_two')->condition('delta', 1)->execute();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_node');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
     $node = node_load(1);
     $this->assertEqual($node->getTitle(), 'New node title');
     // Test a multi-column fields are correctly upgraded.
     $this->assertEqual($node->body->value, 'test');
     $this->assertEqual($node->body->format, 'full_html');
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:MigrateNodeTest.php


示例2: deleteAllUsers

 public static function deleteAllUsers($roles = NULL)
 {
     $count = 0;
     $db_connection = Database::getConnection();
     if (!$roles) {
         $result = $db_connection->query('SELECT uid FROM {users} WHERE uid > 1')->fetchAllAssoc('uid');
         foreach ($result as $data) {
             $user = User::load($data->uid);
             $user->delete();
             $count++;
         }
         // Delete the URL aliases
         $db_connection->query("DELETE FROM {url_alias} WHERE source LIKE 'user/%%'");
     } else {
         if (is_array($roles)) {
             $result = array();
             foreach ($roles as $role) {
                 $result = array_merge($result, db_select('user__roles', 'roles_target_id')->fields('roles_target_id', array('entity_id'))->condition('roles_target_id', $role, '=')->execute()->fetchCol('entity_id'));
             }
         } else {
             $result = db_select('user__roles', 'roles_target_id')->fields('roles_target_id', array('entity_id'))->condition('roles_target_id', $roles, '=')->execute()->fetchCol('entity_id');
         }
         foreach ($result as $data) {
             $user = User::load($data);
             $user->delete();
             $count++;
         }
         // @TODO Delete individual aliases
     }
     return $count;
 }
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:31,代码来源:DeleteUsersForm.php


示例3: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     foreach (Database::getAllConnectionInfo() as $key => $info) {
         Database::startLog('webprofiler', $key);
     }
     return $this->httpKernel->handle($request, $type, $catch);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:10,代码来源:WebprofilerMiddleware.php


示例4: setUpFixtures

  /**
   * Sets up the configuration and schema of views and views_test_data modules.
   *
   * Because the schema of views_test_data.module is dependent on the test
   * using it, it cannot be enabled normally.
   */
  protected function setUpFixtures() {
    // First install the system module. Many Views have Page displays have menu
    // links, and for those to work, the system menus must already be present.
    $this->installConfig(['system']);

    /** @var \Drupal\Core\State\StateInterface $state */
    $state = $this->container->get('state');
    // Define the schema and views data variable before enabling the test module.
    $state->set('views_test_data_schema', $this->schemaDefinition());
    $state->set('views_test_data_views_data', $this->viewsData());

    $this->installConfig(['views', 'views_test_config', 'views_test_data']);
    foreach ($this->schemaDefinition() as $table => $schema) {
      $this->installSchema('views_test_data', $table);
    }

    $this->container->get('router.builder')->rebuild();

    // Load the test dataset.
    $data_set = $this->dataSet();
    $query = Database::getConnection()->insert('views_test_data')
      ->fields(array_keys($data_set[0]));
    foreach ($data_set as $record) {
      $query->values($record);
    }
    $query->execute();
  }
开发者ID:jthoresen,项目名称:PladsenDrupal,代码行数:33,代码来源:ViewsKernelTestBase.php


示例5: validateEntityStrings

  /**
   * {@inheritdoc}
   */
  protected function validateEntityStrings(array &$form, array $values, FormStateInterface $form_state) {
    $uids = array();
    $missing = array();
    foreach ($values as $value) {
      if (Unicode::strtolower($value) === Unicode::strtolower(\Drupal::config('user.settings')->get('anonymous'))) {
        $uids[] = 0;
      }
      else {
        $missing[strtolower($value)] = $value;
      }
    }

    if (!$missing) {
      return $uids;
    }

    $result = Database::getConnection()->query("SELECT * FROM {users} WHERE name IN (:names)", array(':names' => array_values($missing)));
    foreach ($result as $account) {
      unset($missing[strtolower($account->name)]);
      $uids[] = $account->uid;
    }

    if ($missing) {
      $form_state->setError($form, $this->formatPlural(count($missing), 'Unable to find user: @users', 'Unable to find users: @users', array('@users' => implode(', ', $missing))));
    }

    return $uids;
  }
开发者ID:jkyto,项目名称:agolf,代码行数:31,代码来源:SearchApiUser.php


示例6: getOrderIds

 /**
  * Queries database for the order ids of the most recently modified billing
  * addresses. It assumes the billing address on the most recent order are 
  * the most current.
  */
 public function getOrderIds()
 {
     // This query wouldn't work so used the raw MySQL query below. Not sure
     // if the limitation is Drupal's database framework or my understanding
     // of it.
     //$query = $this->select('uc_orders', 'uo')
     //  ->fields('uo', ['order_id']);
     //$query->addExpression('MAX(uo.modified)', 'newest_entry');
     //$query->groupBy('uo.uid');
     //$query->execute();
     //drush_print($query->__toString());
     // Ugly and somewhat hackish. A neater, more Drupal 8 method would be
     // nice. If anyone knows of a better way to do it as I attempted above,
     // I'd love to see it.
     $connection = Database::getConnectionInfo('migrate');
     $mysql_connection = mysqli_connect($connection['default']['host'], $connection['default']['username'], $connection['default']['password'], $connection['default']['database']);
     // Only imports the most recently modified orders for each shopper.
     $result = mysqli_query($mysql_connection, 'SELECT uo.order_id AS order_id, MAX(uo.modified) AS newest_entry 
    FROM uc_orders uo 
    GROUP BY uo.uid');
     $order_ids = array();
     foreach ($result as $row) {
         $order_ids[] = $row['order_id'];
     }
     return $order_ids;
 }
开发者ID:creativepragmatic,项目名称:commerce_migrate,代码行数:31,代码来源:BillingProfile.php


示例7: log

 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = array())
 {
     // Remove any backtraces since they may contain an unserializable variable.
     unset($context['backtrace']);
     // Convert PSR3-style messages to SafeMarkup::format() style, so they can be
     // translated too in runtime.
     $message_placeholders = $this->parser->parseMessagePlaceholders($message, $context);
     try {
         $this->connection->insert('watchdog')->fields(array('uid' => $context['uid'], 'type' => Unicode::substr($context['channel'], 0, 64), 'message' => $message, 'variables' => serialize($message_placeholders), 'severity' => $level, 'link' => $context['link'], 'location' => $context['request_uri'], 'referer' => $context['referer'], 'hostname' => Unicode::substr($context['ip'], 0, 128), 'timestamp' => $context['timestamp']))->execute();
     } catch (\Exception $e) {
         // When running Drupal on MySQL or MariaDB you can run into several errors
         // that corrupt the database connection. Some examples for these kind of
         // errors on the database layer are "1100 - Table 'xyz' was not locked
         // with LOCK TABLES" and "1153 - Got a packet bigger than
         // 'max_allowed_packet' bytes". If such an error happens, the MySQL server
         // invalidates the connection and answers all further requests in this
         // connection with "2006 - MySQL server had gone away". In that case the
         // insert statement above results in a database exception. To ensure that
         // the causal error is written to the log we try once to open a dedicated
         // connection and write again.
         if (($e instanceof DatabaseException || $e instanceof \PDOException) && $this->connection->getTarget() != self::DEDICATED_DBLOG_CONNECTION_TARGET) {
             // Open a dedicated connection for logging.
             $key = $this->connection->getKey();
             $info = Database::getConnectionInfo($key);
             Database::addConnectionInfo($key, self::DEDICATED_DBLOG_CONNECTION_TARGET, $info['default']);
             $this->connection = Database::getConnection(self::DEDICATED_DBLOG_CONNECTION_TARGET, $key);
             // Now try once to log the error again.
             $this->log($level, $message, $context);
         } else {
             throw $e;
         }
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:36,代码来源:DbLog.php


示例8: getDatabase

 /**
  * Get the database connection object.
  *
  * @return \Drupal\Core\Database\Connection
  *   The database connection.
  */
 public function getDatabase()
 {
     if (!isset($this->database)) {
         $this->database = Database::getConnection('default', 'migrate');
     }
     return $this->database;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:13,代码来源:SqlBase.php


示例9: getDatabaseConnection

 /**
  * Parse input options decide on a database.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  *   Input object.
  * @return \Drupal\Core\Database\Connection
  */
 protected function getDatabaseConnection(InputInterface $input)
 {
     // Load connection from a url.
     if ($input->getOption('database-url')) {
         // @todo this could probably be refactored to not use a global connection.
         // Ensure database connection isn't set.
         if (Database::getConnectionInfo('db-tools')) {
             throw new \RuntimeException('Database "db-tools" is already defined. Cannot define database provided.');
         }
         $info = Database::convertDbUrlToConnectionInfo($input->getOption('database-url'), \Drupal::root());
         Database::addConnectionInfo('db-tools', 'default', $info);
         $key = 'db-tools';
     } else {
         $key = $input->getOption('database');
     }
     // If they supplied a prefix, replace it in the connection information.
     $prefix = $input->getOption('prefix');
     if ($prefix) {
         $info = Database::getConnectionInfo($key)['default'];
         $info['prefix']['default'] = $prefix;
         Database::removeConnection($key);
         Database::addConnectionInfo($key, 'default', $info);
     }
     return Database::getConnection('default', $key);
 }
开发者ID:318io,项目名称:318-io,代码行数:32,代码来源:DbCommandBase.php


示例10: testInvalidCropValues

 /**
  * Test that missing action's causes failures.
  */
 public function testInvalidCropValues()
 {
     Database::getConnection('default', 'migrate')->insert("imagecache_action")->fields(['presetid', 'weight', 'module', 'action', 'data'])->values(['presetid' => '1', 'weight' => '0', 'module' => 'imagecache', 'action' => 'imagecache_crop', 'data' => serialize(['xoffset' => '10', 'yoffset' => '10'])])->execute();
     $this->startCollectingMessages();
     $this->executeMigration('d6_imagecache_presets');
     $this->assertEqual(['error' => ['The Drupal 8 image crop effect does not support numeric values for x and y offsets. Use keywords to set crop effect offsets instead.']], $this->migrateMessages);
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:10,代码来源:MigrateImageCacheTest.php


示例11: checkReplicaServer

 /**
  * Checks and disables the replica database server if appropriate.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The Event to process.
  */
 public function checkReplicaServer(GetResponseEvent $event)
 {
     // Ignore replica database servers for this request.
     //
     // In Drupal's distributed database structure, new data is written to the
     // master and then propagated to the replica servers.  This means there is a
     // lag between when data is written to the master and when it is available
     // on the replica. At these times, we will want to avoid using a replica server
     // temporarily. For example, if a user posts a new node then we want to
     // disable the replica server for that user temporarily to allow the replica
     // server to catch up.
     // That way, that user will see their changes immediately while for other
     // users we still get the benefits of having a replica server, just with
     // slightly stale data.  Code that wants to disable the replica server should
     // use the db_set_ignore_replica() function to set
     // $_SESSION['ignore_replica_server'] to the timestamp after which the replica
     // can be re-enabled.
     if (isset($_SESSION['ignore_replica_server'])) {
         if ($_SESSION['ignore_replica_server'] >= REQUEST_TIME) {
             Database::ignoreTarget('default', 'replica');
         } else {
             unset($_SESSION['ignore_replica_server']);
         }
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:31,代码来源:ReplicaDatabaseIgnoreSubscriber.php


示例12: testFiles

 /**
  * Tests the Drupal 6 files to Drupal 8 migration.
  */
 public function testFiles()
 {
     /** @var \Drupal\file\FileInterface $file */
     $file = entity_load('file', 1);
     $this->assertIdentical('Image1.png', $file->getFilename());
     $this->assertIdentical('39325', $file->getSize());
     $this->assertIdentical('public://image-1.png', $file->getFileUri());
     $this->assertIdentical('image/png', $file->getMimeType());
     // It is pointless to run the second half from MigrateDrupal6Test.
     if (empty($this->standalone)) {
         return;
     }
     // Test that we can re-import and also test with file_directory_path set.
     db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute();
     $migration = entity_load_unchanged('migration', 'd6_file');
     $dumps = array($this->getDumpDirectory() . '/Variable.php');
     $this->prepare($migration, $dumps);
     // Update the file_directory_path.
     Database::getConnection('default', 'migrate')->update('variable')->fields(array('value' => serialize('files/test')))->condition('name', 'file_directory_path')->execute();
     Database::getConnection('default', 'migrate')->update('variable')->fields(array('value' => serialize('/tmp')))->condition('name', 'file_directory_temp')->execute();
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
     $file = entity_load('file', 2);
     $this->assertIdentical('public://core/modules/simpletest/files/image-2.jpg', $file->getFileUri());
     // Ensure that a temporary file has been migrated.
     $file = entity_load('file', 6);
     $this->assertIdentical('temporary://some-temp-file.jpg', $file->getFileUri());
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:31,代码来源:MigrateFileTest.php


示例13: testInsertDuplicateData

 /**
  * Tests aborting of traditional SQL database systems with invalid data.
  */
 function testInsertDuplicateData()
 {
     // Try to insert multiple records where at least one has bad data.
     try {
         db_insert('test')->fields(array('name', 'age', 'job'))->values(array('name' => 'Elvis', 'age' => 63, 'job' => 'Singer'))->values(array('name' => 'John', 'age' => 17, 'job' => 'Consultant'))->values(array('name' => 'Frank', 'age' => 75, 'job' => 'Singer'))->execute();
         $this->fail('Insert succeeded when it should not have.');
     } catch (IntegrityConstraintViolationException $e) {
         // Check if the first record was inserted.
         $name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 63))->fetchField();
         if ($name == 'Elvis') {
             if (!Database::getConnection()->supportsTransactions()) {
                 // This is an expected fail.
                 // Database engines that don't support transactions can leave partial
                 // inserts in place when an error occurs. This is the case for MySQL
                 // when running on a MyISAM table.
                 $this->pass("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions");
             } else {
                 $this->fail('The whole transaction is rolled back when a duplicate key insert occurs.');
             }
         } else {
             $this->pass('The whole transaction is rolled back when a duplicate key insert occurs.');
         }
         // Ensure the other values were not inserted.
         $record = db_select('test')->fields('test', array('name', 'age'))->condition('age', array(17, 75), 'IN')->execute()->fetchObject();
         $this->assertFalse($record, 'The rest of the insert aborted as expected.');
     }
 }
开发者ID:318io,项目名称:318-io,代码行数:30,代码来源:InvalidDataTest.php


示例14: getConnection

 /**
  * Gets the database connection for the source Drupal database.
  *
  * @param array $database
  *   Database array representing the source Drupal database.
  *
  * @return \Drupal\Core\Database\Connection
  *   The database connection for the source Drupal database.
  */
 protected function getConnection(array $database)
 {
     // Set up the connection.
     Database::addConnectionInfo('upgrade', 'default', $database);
     $connection = Database::getConnection('default', 'upgrade');
     return $connection;
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:16,代码来源:MigrationConfigurationTrait.php


示例15: countNodesPerType

 /**
  * Cont how many nodes we have of each type.
  */
 protected function countNodesPerType()
 {
     $result = Database::getConnection()->query("SELECT type, COUNT(*) AS num FROM {node} GROUP BY type")->fetchAllAssoc('type');
     foreach ($result as $data) {
         $this->count[$data->type] = $data->num;
     }
 }
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:10,代码来源:DeleteContentForm.php


示例16: testFailedPageCreation

 /**
  * Verifies that a transaction rolls back the failed creation.
  */
 function testFailedPageCreation()
 {
     // Create a node.
     $edit = array('uid' => $this->loggedInUser->id(), 'name' => $this->loggedInUser->name, 'type' => 'page', 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'title' => 'testing_transaction_exception');
     try {
         // An exception is generated by node_test_exception_node_insert() if the
         // title is 'testing_transaction_exception'.
         entity_create('node', $edit)->save();
         $this->fail(t('Expected exception has not been thrown.'));
     } catch (\Exception $e) {
         $this->pass(t('Expected exception has been thrown.'));
     }
     if (Database::getConnection()->supportsTransactions()) {
         // Check that the node does not exist in the database.
         $node = $this->drupalGetNodeByTitle($edit['title']);
         $this->assertFalse($node, 'Transactions supported, and node not found in database.');
     } else {
         // Check that the node exists in the database.
         $node = $this->drupalGetNodeByTitle($edit['title']);
         $this->assertTrue($node, 'Transactions not supported, and node found in database.');
         // Check that the failed rollback was logged.
         $records = db_query("SELECT wid FROM {watchdog} WHERE message LIKE 'Explicit rollback failed%'")->fetchAll();
         $this->assertTrue(count($records) > 0, 'Transactions not supported, and rollback error logged to watchdog.');
     }
     // Check that the rollback error was logged.
     $records = db_query("SELECT wid FROM {watchdog} WHERE variables LIKE '%Test exception for rollback.%'")->fetchAll();
     $this->assertTrue(count($records) > 0, 'Rollback explanatory error logged to watchdog.');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:31,代码来源:NodeCreationTest.php


示例17: testConnectionTypes

 /**
  * Test different connection types.
  */
 public function testConnectionTypes()
 {
     $sql_base = new TestSqlBase();
     // Check the default values.
     $this->assertIdentical($sql_base->getDatabase()->getTarget(), 'default');
     $this->assertIdentical($sql_base->getDatabase()->getKey(), 'migrate');
     $target = 'test_db_target';
     $key = 'test_migrate_connection';
     $config = array('target' => $target, 'key' => $key);
     $sql_base->setConfiguration($config);
     Database::addConnectionInfo($key, $target, Database::getConnectionInfo('default')['default']);
     // Validate we've injected our custom key and target.
     $this->assertIdentical($sql_base->getDatabase()->getTarget(), $target);
     $this->assertIdentical($sql_base->getDatabase()->getKey(), $key);
     // Now test we can have SqlBase create the connection from an info array.
     $sql_base = new TestSqlBase();
     $target = 'test_db_target2';
     $key = 'test_migrate_connection2';
     $database = Database::getConnectionInfo('default')['default'];
     $config = array('target' => $target, 'key' => $key, 'database' => $database);
     $sql_base->setConfiguration($config);
     // Call getDatabase() to get the connection defined.
     $sql_base->getDatabase();
     // Validate the connection has been created with the right values.
     $this->assertIdentical(Database::getConnectionInfo($key)[$target], $database);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:29,代码来源:SqlBaseTest.php


示例18: testFailedTicketCreation

 /**
  * Verifies that a transaction rolls back the failed creation.
  */
 function testFailedTicketCreation()
 {
     // Create a support_ticket.
     $edit = array('uid' => $this->loggedInUser->id(), 'name' => $this->loggedInUser->name, 'support_ticket_type' => 'ticket', 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'title' => 'testing_transaction_exception');
     try {
         // An exception is generated by support_ticket_test_exception_support_ticket_insert() if the
         // title is 'testing_transaction_exception'.
         entity_create('support_ticket', $edit)->save();
         $this->fail(t('Expected exception has not been thrown.'));
     } catch (\Exception $e) {
         $this->pass(t('Expected exception has been thrown.'));
     }
     if (Database::getConnection()->supportsTransactions()) {
         // Check that the support_ticket does not exist in the database.
         $support_ticket = $this->supportTicketGetTicketByTitle($edit['title']);
         $this->assertFalse($support_ticket, 'Transactions supported, and support_ticket not found in database.');
     } else {
         // Check that the support_ticket exists in the database.
         $support_ticket = $this->supportTicketGetTicketByTitle($edit['title']);
         $this->assertTrue($support_ticket, 'Transactions not supported, and support_ticket found in database.');
         // Check that the failed rollback was logged.
         $records = static::getWatchdogIdsForFailedExplicitRollback();
         $this->assertTrue(count($records) > 0, 'Transactions not supported, and rollback error logged to watchdog.');
     }
     // Check that the rollback error was logged.
     $records = static::getWatchdogIdsForTestExceptionRollback();
     $this->assertTrue(count($records) > 0, 'Rollback explanatory error logged to watchdog.');
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:31,代码来源:SupportTicketCreationTest.php


示例19: __construct

 public function __construct()
 {
     $this->connection = \Drupal\Core\Database\Database::getConnection();
     $this->module_config = \Drupal::config('sociallogin.settings');
     $this->apiSecret = trim($this->module_config->get('api_secret'));
     $this->apiKey = trim($this->module_config->get('api_key'));
 }
开发者ID:LoginRadius,项目名称:drupal-identity-module,代码行数:7,代码来源:UserRegistrationUserManager.php


示例20: __construct

 public function __construct($database)
 {
     global $ss_client;
     $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
     require_once DRUPAL_ROOT . '/core/includes/database.inc';
     Database::setMultipleConnectionInfo($database);
     $this->connection = Database::getConnection();
     $this->ss_client =& $ss_client;
     $this->database = $database;
     $query = db_select('config', 'n')->fields('n')->condition('name', $this->options, 'IN');
     $result = $query->execute();
     if ($result && is_object($result)) {
         foreach ($result as $key => $row) {
             $values = unserialize($row->data);
             foreach ($values[key($values)] as $value_key => $value) {
                 $this->data_options[$value_key] = $value;
             }
         }
     }
     if (defined('STACKSIGHT_SETTINGS_IN_DB') && STACKSIGHT_SETTINGS_IN_DB === true) {
         if (isset($this->data_options['token'])) {
             $this->ready = true;
         }
     } else {
         $this->ready = true;
     }
     define('STACKSIGHT_PHP_SDK_INCLUDE', TRUE);
 }
开发者ID:stacksight,项目名称:stacksight-php-sdk,代码行数:28,代码来源:bootstrap-drupal-8.php



注:本文中的Drupal\Core\Database\Database类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Query\SelectInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Database\Connection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap