You are here

class SqlsrvServiceProvider in Drupal driver for SQL Server and SQL Azure 8.2

Hierarchy

Expanded class hierarchy of SqlsrvServiceProvider

File

src/SqlsrvServiceProvider.php, line 9

Namespace

Drupal\sqlsrv
View source
class SqlsrvServiceProvider implements ServiceProviderInterface {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {

    // Float columns are only broken in the PDO driver version prior to 4.0.0
    // the actual version number differs from Linux/Windows as they keep different
    // versioning...
    // TODO: Remove this in the future, these lock overrides are not needed
    // anymore after the fixes in the PDO driver.
    // @see https://github.com/Microsoft/msphpsql/releases/tag/4.1.0
    if (($version = phpversion("pdo_sqlsrv")) && version_compare($version, '4.0.0', '<')) {
      $definition = $container
        ->getDefinition('lock');
      if ($definition
        ->getClass() == \Drupal\Core\Lock\DatabaseLockBackend::class) {
        $definition
          ->setClass(\Drupal\sqlsrv\Lock\DatabaseLockBackend::class);
      }
      $definition = $container
        ->getDefinition('lock.persistent');
      if ($definition
        ->getClass() == \Drupal\Core\Lock\PersistentDatabaseLockBackend::class) {
        $definition
          ->setClass(\Drupal\sqlsrv\Lock\PersistentDatabaseLockBackend::class);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SqlsrvServiceProvider::register public function Registers services to the container. Overrides ServiceProviderInterface::register