/** * @see sfPluginConfiguration */ public function initialize() { sfConfig::set('sf_orm', 'propel'); if (!sfConfig::get('sf_admin_module_web_dir')) { sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin'); } sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor')))); require_once 'propel/Propel.php'; if (!Propel::isInit()) { if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { Propel::setLogger(new sfPropelLogger($this->dispatcher)); } $propelConfiguration = new PropelConfiguration(); Propel::setConfiguration($propelConfiguration); $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure')); Propel::initialize(); } $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent')); if (sfConfig::get('sf_web_debug')) { $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent')); } if (sfConfig::get('sf_test')) { $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools')); } }
protected function tearDown() { if ($this->oldPropelConfiguration) { Propel::setConfiguration($this->oldPropelConfiguration); Propel::initialize(); } parent::tearDown(); }
protected function setUp() { parent::setUp(); $xmlDom = new DOMDocument(); $xmlDom->load(dirname(__FILE__) . '/../../../../fixtures/reverse/mysql/runtime-conf.xml'); $xml = simplexml_load_string($xmlDom->saveXML()); $phpconf = OpenedPropelConvertConfTask::simpleXmlToArray($xml); Propel::setConfiguration($phpconf); Propel::initialize(); }
function initialize() { set_include_path(realpath(dirname(__FILE__) . '/build/classes') . PATH_SEPARATOR . get_include_path()); require_once "vendor/autoload.php"; $conf = (include realpath(dirname(__FILE__) . '/build/conf/bookstore-conf.php')); $conf['log'] = null; Propel::setConfiguration($conf); Propel::initialize(); Propel::disableInstancePooling(); $this->con = Propel::getConnection('bookstore'); $this->initTables(); }
function initialize() { $loader = (require_once __DIR__ . '/../propel_16/vendor/autoload.php'); set_include_path(__DIR__ . '/build/classes'); $conf = (include realpath(dirname(__FILE__) . '/build/conf/bookstore-conf.php')); $conf['log'] = null; Propel::setConfiguration($conf); Propel::initialize(); Propel::disableInstancePooling(); $this->con = Propel::getConnection('bookstore'); $this->con->setAttribute(PropelPDO::PROPEL_ATTR_CACHE_PREPARES, true); $this->initTables(); }
protected function setUp() { $this->markTestSkipped('PGSQL unit test'); parent::setUp(); $xmlDom = new DOMDocument(); $xmlDom->load(dirname(__FILE__) . '/../../../../fixtures/reverse/pgsql/runtime-conf.xml'); $xml = simplexml_load_string($xmlDom->saveXML()); $phpconf = TestablePropelConvertConfTask::simpleXmlToArray($xml); Propel::setConfiguration($phpconf); Propel::initialize(); $this->con = Propel::getConnection('reverse-bookstore'); $this->con->beginTransaction(); }
function initialize() { set_include_path(realpath(dirname(__FILE__) . '/build/classes') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../propel_17/vendor/propel/runtime/lib') . PATH_SEPARATOR . get_include_path()); require_once 'Propel.php'; $conf = (include realpath(dirname(__FILE__) . '/build/conf/bookstore-conf.php')); $conf['log'] = null; Propel::setConfiguration($conf); Propel::initialize(); Propel::disableInstancePooling(); $this->con = Propel::getConnection('bookstore'); $this->con->setAttribute(PropelPDO::PROPEL_ATTR_CACHE_PREPARES, true); $this->initTables(); }
public static function initialize() { $dbConfigs = array(); $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaDatabaseConfig'); foreach ($pluginInstances as $pluginInstance) { $dbConfigs[] = $pluginInstance->getDatabaseConfig(); } foreach ($dbConfigs as $dbConfig) { self::addExtraConfiguration($dbConfig); } Propel::setConfiguration(self::$config); Propel::setLogger(KalturaLog::getInstance()); Propel::initialize(); }
public static function initialize() { $dbConfigs = self::getExtraDatabaseConfigs(); foreach ($dbConfigs as $dbConfig) { self::addExtraConfiguration($dbConfig); } Propel::setConfiguration(self::$config); Propel::setLogger(KalturaLog::getInstance()); try { Propel::initialize(); } catch (PropelException $pex) { KalturaLog::alert($pex->getMessage()); throw new PropelException("Database error"); } }
/** * {@inheritdoc} */ public function boot() { require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php'; if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { set_include_path($this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path()); } if (!\Propel::isInit()) { \Propel::setConfiguration($this->container->get('propel.configuration')); if ($this->container->getParameter('propel.logging')) { $this->container->get('propel.configuration')->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true))); \Propel::setLogger($this->container->get('propel.logger')); } \Propel::initialize(); } }
/** * {@inheritdoc} */ public function boot() { require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php'; if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path()); } if (!\Propel::isInit()) { \Propel::setConfiguration($this->container->get('propel.configuration')); if ($this->container->getParameter('propel.logging')) { $config = $this->container->get('propel.configuration'); $config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false); $config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true))); \Propel::setLogger($this->container->get('propel.logger')); } \Propel::initialize(); } }
function initialize() { set_include_path(realpath(dirname(__FILE__) . '/build/classes') . PATH_SEPARATOR . get_include_path()); if (file_exists("propel_16/vendor/autoload.php")) { require_once "propel_16/vendor/autoload.php"; } else { require_once "../propel_16/vendor/autoload.php"; } $conf = (include realpath(dirname(__FILE__) . '/build/conf/bookstore-conf.php')); $conf['log'] = null; Propel::setConfiguration($conf); Propel::initialize(); Propel::disableInstancePooling(); $this->con = Propel::getConnection('bookstore'); $this->con->setAttribute(PropelPDO::PROPEL_ATTR_CACHE_PREPARES, true); $this->initTables(); }
/** * {@inheritdoc} */ public function boot() { trigger_error("The PropelBundle uses a new branching model, you should switch to the 1.1 branch (1.1.x versions). For more information, please read: https://github.com/propelorm/PropelBundle/wiki", E_USER_DEPRECATED); require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php'; if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) { set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path()); } if (!\Propel::isInit()) { \Propel::setConfiguration($this->container->get('propel.configuration')); if ($this->container->getParameter('propel.logging')) { $config = $this->container->get('propel.configuration'); $config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false); $config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true))); \Propel::setLogger($this->container->get('propel.logger')); } \Propel::initialize(); } }
/** * Initialize sfymfony propel * * @param sfEventDispatcher $dispatcher * @param string $culture */ public static function initialize(sfEventDispatcher $dispatcher, $culture = null) { if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { // add propel logger Propel::setLogger(new sfPropelLogger($dispatcher)); } // propel initialization $configuration = sfPropelDatabase::getConfiguration(); if ($configuration) { Propel::setConfiguration($configuration); if (!Propel::isInit()) { Propel::initialize(); } } $dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent')); if (!is_null($culture)) { self::setDefaultCulture($culture); } else { if (class_exists('sfContext', false) && sfContext::hasInstance() && ($user = sfContext::getInstance()->getUser())) { self::setDefaultCulture($user->getCulture()); } } self::$initialized = true; }
/** * Initializes sfPropelDatabase by loading configuration and initializing Propel * * @param array $parameters The datasource parameters * @param string $name The datasource name * * @return void */ public function initialize($parameters = null, $name = 'propel') { parent::initialize($parameters); if (!$this->hasParameter('datasource') && $this->hasParameter('name')) { $this->setParameter('datasource', $this->getParameter('name')); } elseif (!$this->hasParameter('datasource') && !empty($name)) { $this->setParameter('datasource', $name); } $this->addConfig(); $is_default = $this->getParameter('is_default', false); // first defined if none listed as default if ($is_default || 1 == count(self::$config['propel']['datasources'])) { $this->setDefaultConfig(); } Propel::setConfiguration(self::$config[$name]); if ($this->getParameter('pooling', false)) { Propel::enableInstancePooling(); } else { Propel::disableInstancePooling(); } if (!Propel::isInit()) { Propel::initialize(); } }
* (c) 2007 Rob Rosenbaum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /* * The contents of this file came mostly from the following page: * http://www.symfony-project.com/snippets/snippet/215 */ if (!@constant('SF_APP')) { die('Constant "SF_APP" must be defined in your test script.' . "\n"); } if (!@constant('SF_ENVIRONMENT')) { // Only load constants in not done before (group tests) define('SF_ENVIRONMENT', 'test'); define('SF_DEBUG', TRUE); define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../../..')); $_test_dir = SF_ROOT_DIR . '/test'; // symfony directories include SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; require_once $sf_symfony_lib_dir . '/vendor/lime/lime.php'; require_once $sf_symfony_lib_dir . '/util/sfCore.class.php'; require_once dirname(__FILE__) . '/../lib/sfPropelTest.php'; sfCore::initSimpleAutoload(array(SF_ROOT_DIR . '/lib/model', $sf_symfony_lib_dir, SF_ROOT_DIR . '/lib', SF_ROOT_DIR . '/apps/theApp/lib', SF_ROOT_DIR . '/plugins')); // Location plugins set_include_path($sf_symfony_lib_dir . '/vendor' . PATH_SEPARATOR . SF_ROOT_DIR . PATH_SEPARATOR . get_include_path()); sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir); sfContext::getInstance(); Propel::setConfiguration(sfPropelDatabase::getConfiguration()); Propel::initialize(); }
private static function enableSlaveConf($dbName) { $configuration = Propel::getConfiguration(); if (!isset($configuration['datasources'][$dbName]['slaves']['connection'])) { $configuration['datasources'][$dbName]['slaves']['connection'] = self::$_slaveConfig[$dbName]; Propel::setConfiguration($configuration); Propel::initialize(); } Propel::setForceMasterConnection(false); }
public function __construct($config) { Propel::setConfiguration($config); Propel::initialize(); $this->loadProcesses(); }
/** * Initializes Propel. */ private static function initPropel() { if (!file_exists(self::$config->curry->propel->conf)) { self::log("Propel configuration missing, skipping propel initialization."); return; } // Use Composer autoloader instead of the built-in propel autoloader Propel::configure(self::$config->curry->propel->conf); $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT); $classmap = array(); $projectClassPath = self::$config->curry->propel->projectClassPath; foreach ($config['classmap'] as $className => $file) { $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file; } $level = error_reporting(error_reporting() & ~E_USER_WARNING); Propel::initialize(); PropelAutoloader::getInstance()->unregister(); self::getAutoloader()->addClassMap($classmap); error_reporting($level); // Initialize debugging/logging if (self::$config->curry->propel->debug) { Propel::getConnection()->useDebug(true); if (self::$logger && self::$config->curry->propel->logging) { Propel::setLogger(self::$logger); } } }
/** * Initializes Propel. */ protected function initPropel() { if (!file_exists($this['propel.conf'])) { $this->logger->notice("Propel configuration missing, skipping propel initialization."); return; } // Use Composer autoloader instead of the built-in propel autoloader \Propel::configure($this['propel.conf']); $config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT); $classmap = array(); $projectClassPath = $this['propel.projectClassPath']; foreach ($config['classmap'] as $className => $file) { $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file; } $level = error_reporting(error_reporting() & ~E_USER_WARNING); \Propel::initialize(); \PropelAutoloader::getInstance()->unregister(); $this->autoloader->addClassMap($classmap); error_reporting($level); // Initialize debugging/logging if ($this['propel.debug']) { \Propel::getConnection()->useDebug(true); if ($this['propel.logging']) { \Propel::setLogger($this->logger); } } }
public function testGetCorrectTableMapClassWithAbstractSingleTableInheritance() { Propel::initialize(); $this->assertInstanceOf('DistributionTableMap', DistributionPeer::getTableMap(), 'getTableMap should return the right table map'); }
public function __construct($config) { Propel::setConfiguration($config); Propel::initialize(); }