承接 contaoblackforest/contao-doctrine-dbal-driver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

contaoblackforest/contao-doctrine-dbal-driver

最新稳定版本:3.2.2

Composer 安装命令:

composer require contaoblackforest/contao-doctrine-dbal-driver

包简介

Database Driver using Doctrine DBAL for Contao Open Source CMS

README 文档

README

To use this database driver, change the driver in your system/config/localconfig.php:

$GLOBALS['TL_CONFIG']['dbDriver'] = 'DoctrineMySQL';

Configure caching

By default, the driver use an array cache (equivalent to contao). But the caching can be configured with $GLOBALS['TL_CONFIG']['dbCache'], $GLOBALS['TL_CONFIG']['dbCacheTTL'] and $GLOBALS['TL_CONFIG']['dbCacheName'].

$GLOBALS['TL_CONFIG']['dbCache'] define the caching mechanism, possible values are:

apc use apc cache
xcache use xcache cache
memcache://<host>[:<port>] use memcache cache on <host>:<port>
redis://<host>[:<port>] use redis cache on <host>:<port>
redis://<socket> use redis cache on <socket> file
array use array cache
false disable the cache

$GLOBALS['TL_CONFIG']['dbCacheTTL'] is an integer value, that define the time to live (default value is 1 second for backend and 15 second for frontend).

$GLOBALS['TL_CONFIG']['dbCacheName'] is a string for uniq identify cache entries. This is useful if you have a shared cache like memcache (default value is md5(/absolute/path/to/bit3/contao-doctrine-dbal-driver/src/Contao/Doctrine/Driver/MySQL/Statement.php)).

Different caching in frontend and backend

You can add _FE or _BE to each cache config key, to define different caching in frontend and backend. For example $GLOBALS['TL_CONFIG']['dbCache_FE'] define the frontend caching mechanism and $GLOBALS['TL_CONFIG']['dbCacheTTL_BE'] define the backend caching time to live.

Accessing the doctrine dbal connection

If you have installed bit3/contao-doctrine-dbal, you should use the dependency injection container:

class MyClass
{
	public function myFunc()
	{
		global $container;
		/** @var \Doctrine\DBAL\Connection $connection */
		$connection = $container['doctrine.connection.default'];

		$connection->query('...');
	}
}

Alternatively you can get the connection from the database instance:

class MyClass
{
	public function myFunc()
	{
		/** @var \Doctrine\DBAL\Connection $connection */
		$connection = Database::getInstance()->getConnection();
	}
}

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 2

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-05-28