本文整理汇总了PHP中Doctrine_Manager::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Manager::setAttribute方法的具体用法?PHP Doctrine_Manager::setAttribute怎么用?PHP Doctrine_Manager::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Manager
的用法示例。
在下文中一共展示了Doctrine_Manager::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureDoctrine
/**
* Configure the Doctrine engine
**/
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, new Doctrine_Cache_Apc());
$manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, new Doctrine_Cache_Apc());
$options = array('baseClassName' => 'DarwinModel');
sfConfig::set('doctrine_model_builder_options', $options);
}
示例2: configureDoctrineCache
protected function configureDoctrineCache(Doctrine_Manager $manager)
{
if (sfConfig::get('dm_orm_cache_enabled', true) && dmAPCCache::isEnabled()) {
$driver = new Doctrine_Cache_Apc(array('prefix' => dmProject::getNormalizedRootDir() . '/doctrine/'));
$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $driver);
$manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $driver);
$manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, sfConfig::get('dm_orm_cache_lifespan', 3600));
}
}
示例3: configureDoctrine
/**
* Configure doctrine connections to use tablename prefix hs_hr_
*/
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
//
// If using encryption, enable dql callbacks. Needed by EncryptionListener
//
if (KeyHandler::keyExists()) {
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
//$manager->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, 'hs_hr_%s');
}
示例4: __construct
/**
*
*/
protected function __construct()
{
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
$this->loadPlatformInstance();
// load the doctrine class loader
spl_autoload_register(array('Doctrine', 'autoload'));
// Load up the manager and put base settings
$this->manager = Doctrine_Manager::getInstance();
$this->manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_PEAR);
$this->manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true);
$this->_initializeExtensions();
$this->connection = Doctrine_Manager::connection($this->platform_instance->getConnectionUrl(), 'default');
}
示例5: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
$manager->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
// $cacheConn = Doctrine_Manager::connection(new PDO('sqlite::memory:'));
// $cacheDriver = new Doctrine_Cache_Db(array('connection' => $cacheConn, 'tableName' =>'cache'));
// $cacheDriver->createTable();
// $cacheDriver = new Doctrine_Cache_Memcache();
// $cacheDriver = new Doctrine_Cache_Apc();
// $cacheDriver = new Doctrine_Cache_Array();
// $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $cacheDriver);
// $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);
// $manager->setAttribute(Doctrine_Core::ATTR_QUERY_LIMIT, Doctrine_Core::LIMIT_RECORDS);
$manager->setAttribute(Doctrine_Core::ATTR_PORTABILITY, Doctrine_Core::PORTABILITY_EMPTY_TO_NULL);
// $options = array('baseClassName' => 'BaseDoctrineRecord');
// sfConfig::set('doctrine_model_builder_options', $options);
}
示例6: configureDoctrine
/**
* Configure doctrine connections to use tablename prefix hs_hr_
*/
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'ohrmDoctrineQuery');
//
// If using encryption, enable dql callbacks. Needed by EncryptionListener
//
if (KeyHandler::keyExists()) {
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
//$manager->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, 'hs_hr_%s');
// Allow running doctrine:build-schema without error
$isCli = php_sapi_name() == "cli";
if (true == $isCli) {
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, false);
}
}
示例7: configureDoctrine
/**
* Настройки Doctrine
*/
public function configureDoctrine(Doctrine_Manager $manager)
{
// Legacy database
$manager->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);
// $manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, false);
$manager->setAttribute(Doctrine_Core::ATTR_DEFAULT_TABLE_CHARSET, 'utf8');
$manager->setAttribute(Doctrine_Core::ATTR_DEFAULT_TABLE_COLLATE, 'utf8_general_ci');
$manager->setAttribute(Doctrine_Core::ATTR_DEFAULT_TABLE_TYPE, 'INNODB');
// Глобальный кастомный Query класс
// @see http://www.doctrine-project.org/projects/orm/1.2/docs/manual/configuration/en#configure-query-class
$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'myBaseQuery');
// SoftDelete
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
// что бы использовать IF | CASE и проч. SQL-полезняшки
$manager->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL ^ Doctrine::PORTABILITY_EXPR);
// Кастомный гидратор
$manager->registerHydrator('FetchPair', 'Doctrine_Hydrator_FetchPair');
}
示例8: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'myDoctrineQuery');
}
示例9: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, false);
}
示例10: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
//Adding my own Doctrine_Collection class
$manager->setAttribute(Doctrine::ATTR_COLLECTION_CLASS, 'cukorkaCollection');
}
示例11: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
// Enable callbacks so that softDelete behavior can be used
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
示例12: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_COLLECTION_CLASS, 'Doctrine_Collection_Extra');
}
示例13: configureDoctrine
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%s');
$manager->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);
}
示例14: configureDoctrine
/**
* Настройки Doctrine
*/
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine::ATTR_QUERY_CLASS, 'MyQuery');
$manager->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
$manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
}
示例15: configureDoctrine
/**
* Configure the Doctrine engine
*/
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'Doctrine_Query_Extra');
}