本文整理汇总了PHP中Propel::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::initialize方法的具体用法?PHP Propel::initialize怎么用?PHP Propel::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* @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'));
}
}
示例2: tearDown
protected function tearDown()
{
if ($this->oldPropelConfiguration) {
Propel::setConfiguration($this->oldPropelConfiguration);
Propel::initialize();
}
parent::tearDown();
}
示例3: setUp
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();
}
示例4: 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();
}
示例5: initialize
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();
}
示例6: setUp
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();
}
示例7: initialize
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();
}
示例8: initialize
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();
}
示例9: 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");
}
}
示例10: boot
/**
* {@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();
}
}
示例11: boot
/**
* {@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();
}
}
示例12: 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();
}
示例13: boot
/**
* {@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();
}
}
示例14: 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;
}
示例15: initialize
/**
* 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();
}
}