当前位置: 首页>>代码示例>>PHP>>正文


PHP Propel::isInit方法代码示例

本文整理汇总了PHP中Propel::isInit方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::isInit方法的具体用法?PHP Propel::isInit怎么用?PHP Propel::isInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Propel的用法示例。


在下文中一共展示了Propel::isInit方法的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'));
     }
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:28,代码来源:sfPropelPluginConfiguration.class.php

示例2: getConnection

 /**
  * @param string $name
  * @return PDO
  */
 public static function getConnection($name)
 {
     if (!Propel::isInit()) {
         DbManager::setConfig(kConf::getDB());
         DbManager::initialize();
     }
     return Propel::getConnection($name);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:12,代码来源:myDbHelper.class.php

示例3: 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();
     }
 }
开发者ID:haasalex,项目名称:PropelBundle,代码行数:18,代码来源:PropelBundle.php

示例4: setUp

 protected function setUp()
 {
     if (Propel::isInit()) {
         $this->oldPropelConfiguration = Propel::getConfiguration();
     }
     $xmlDom = new DOMDocument();
     $xmlDom->load(dirname(__FILE__) . '/../../fixtures/reverse/mysql/runtime-conf.xml');
     $xml = simplexml_load_string($xmlDom->saveXML());
     $phpconf = PlatformDatabaseBuildTimeBaseTask::simpleXmlToArray($xml);
     Propel::setConfiguration($phpconf);
     Propel::initialize();
     $this->con = Propel::getConnection('reverse-bookstore');
     $this->parser = new MysqlSchemaParser(Propel::getConnection('reverse-bookstore'));
     $this->parser->setGeneratorConfig(new QuickGeneratorConfig(new MysqlPlatform()));
     parent::setUp();
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:16,代码来源:PlatformDatabaseBuildTimeBase.php

示例5: getConnection

 /**
  * @param string $name
  * @return PDO
  */
 public static function getConnection($name)
 {
     if (!Propel::isInit()) {
         DbManager::setConfig(kConf::getDB());
         DbManager::initialize();
     }
     $slaves = array(self::DB_HELPER_CONN_PROPEL2, self::DB_HELPER_CONN_PROPEL3);
     if (!in_array($name, $slaves)) {
         return Propel::getConnection($name);
     }
     list($connection, $connIndex) = DbManager::connectFallbackLogic(array('Propel', 'getConnection'), array(), $slaves);
     if (!$connection) {
         throw new PropelException('Could not connect to any database server');
     }
     return $connection;
 }
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:myDbHelper.class.php

示例6: 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();
     }
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:20,代码来源:PropelBundle.php

示例7: 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();
     }
 }
开发者ID:angelk,项目名称:PropelBundle,代码行数:21,代码来源:PropelBundle.php

示例8: build

 public function build($dsn = null, $user = null, $pass = null, $adapter = null)
 {
     if (null === $dsn) {
         $dsn = 'sqlite::memory:';
     }
     if (null === $adapter) {
         $adapter = new DBSQLite();
     }
     $con = new PropelPDO($dsn, $user, $pass);
     $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     $this->buildSQL($con);
     $this->buildClasses();
     $name = $this->getDatabase()->getName();
     if (!Propel::isInit()) {
         Propel::setConfiguration(array());
     }
     Propel::setDB($name, $adapter);
     Propel::setConnection($name, $con, Propel::CONNECTION_READ);
     Propel::setConnection($name, $con, Propel::CONNECTION_WRITE);
     return $con;
 }
开发者ID:halfer,项目名称:Meshing,代码行数:21,代码来源:PropelQuickBuilder.php

示例9: 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;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:30,代码来源:sfPropel.class.php

示例10: 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();
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:32,代码来源:sfPropelDatabase.class.php

示例11: initialize

 /**
  * initialize Propel
  * @return     void
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function initialize()
 {
     if (self::$configuration === null) {
         throw new PropelException("Propel cannot be initialized without " . "a valid configuration. Please check the log files " . "for further details.");
     }
     self::configureLogging();
     // Now that we have dealt with processing the log properties
     // that may be contained in the configuration we will make the
     // configuration consist only of the remaining propel-specific
     // properties that are contained in the configuration. First
     // look for properties that are in the "propel" namespace.
     $originalConf = self::$configuration;
     self::$configuration = isset(self::$configuration['propel']) ? self::$configuration['propel'] : null;
     if (empty(self::$configuration)) {
         // Assume the original configuration already had any
         // prefixes stripped.
         self::$configuration = $originalConf;
     }
     // reset the connection map (this should enable runtime changes of connection params)
     self::$connectionMap = array();
     self::initAdapters(self::$configuration);
     self::$isInit = true;
     // map builders may be registered w/ Propel before Propel has
     // been initialized; in this case they are stored in a static
     // var of this class & now can be propertly initialized.
     foreach (self::$mapBuilders as $mbClass) {
         BasePeer::getMapBuilder($mbClass);
     }
     // now that the pre-loaded map builders have been propertly initialized
     // empty the array.
     // any further mapBuilders will be build by the generated MapBuilder classes.
     self::$mapBuilders = array();
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:39,代码来源:Propel.php

示例12: initialize

 /**
  * Load Propel config
  * 
  * @param      AgaviDatabaseManager The database manager of this instance.
  * @param      array                An assoc array of initialization params.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @since      0.10.0
  */
 public function initialize(AgaviDatabaseManager $databaseManager, array $parameters = array())
 {
     parent::initialize($databaseManager, $parameters);
     $configPath = AgaviToolkit::expandDirectives($this->getParameter('config'));
     $datasource = $this->getParameter('datasource', null);
     $use_as_default = $this->getParameter('use_as_default', false);
     $config = (require $configPath);
     if ($datasource === null || $datasource == 'default') {
         if (isset($config['propel']['datasources']['default'])) {
             $datasource = $config['propel']['datasources']['default'];
         } elseif (isset($config['datasources']['default'])) {
             $datasource = $config['datasources']['default'];
         } else {
             throw new AgaviDatabaseException('No datasource given for Propel connection, and no default datasource specified in runtime configuration file.');
         }
     }
     if (!class_exists('Propel')) {
         include 'propel/Propel.php';
     }
     if (!Propel::isInit()) {
         Propel::init($configPath);
     }
     $is13 = version_compare(Propel::VERSION, '1.4', '<');
     // grab the configuration values and inject possibly defined overrides for this data source
     if ($is13) {
         // old-style config array; PropelConfiguration was added after 1.3.0, http://trac.agavi.org/ticket/1195
         $config = Propel::getConfiguration();
         $config['datasources'][$datasource]['adapter'] = $this->getParameter('overrides[adapter]', $config['datasources'][$datasource]['adapter']);
         $config['datasources'][$datasource]['connection'] = array_merge($config['datasources'][$datasource]['connection'], $this->getParameter('overrides[connection]', array()));
         // also the autoload classes
         $config['datasources'][$datasource]['classes'] = array_merge($config['datasources'][$datasource]['classes'], $this->getParameter('overrides[classes]', array()));
         // and init queries
         if (!isset($config['datasources'][$datasource]['connection']['settings']['queries']['query'])) {
             $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array();
         }
         // array cast because "query" might be a string if just one init query was given, http://trac.agavi.org/ticket/1194
         $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array_merge((array) $config['datasources'][$datasource]['connection']['settings']['queries']['query'], (array) $this->getParameter('init_queries'));
         // set the new config
         Propel::setConfiguration($config);
     } else {
         $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
         $overrides = (array) $this->getParameter('overrides');
         // set override values
         foreach ($overrides as $key => $value) {
             $config->setParameter($key, $value);
         }
         // handle init queries in a cross-adapter fashion (they all support the "init_queries" param)
         $queries = (array) $config->getParameter('datasources.' . $datasource . '.connection.settings.queries.query', array());
         // yes... it's one array, [connection][settings][queries][query], with all the init queries from the config, so we append to that
         $queries = array_merge($queries, (array) $this->getParameter('init_queries'));
         $config->setParameter('datasources.' . $datasource . '.connection.settings.queries.query', $queries);
     }
     if (true === $this->getParameter('enable_instance_pooling')) {
         Propel::enableInstancePooling();
     } elseif (false === $this->getParameter('enable_instance_pooling')) {
         Propel::disableInstancePooling();
     }
 }
开发者ID:horros,项目名称:agavi,代码行数:67,代码来源:AgaviPropelDatabase.class.php

示例13: initialize

 /**
  * Initializes Propel
  *
  * @throws PropelException Any exceptions caught during processing will be
  *                             rethrown wrapped into a PropelException.
  */
 public static function initialize()
 {
     if (self::$configuration === null) {
         throw new PropelException("Propel cannot be initialized without a valid configuration. Please check the log files for further details.");
     }
     self::configureLogging();
     // check whether the generated model has the same version as the runtime, see gh-#577
     // we need to check for existance first, because tasks which rely on the runtime.xml conf will not provide a generator_version
     if (isset(self::$configuration['generator_version']) && self::$configuration['generator_version'] != self::VERSION) {
         $warning = "Version mismatch: The generated model was build using propel '" . self::$configuration['generator_version'] . "' while the current runtime is at version '" . self::VERSION . "'";
         if (self::$logger) {
             self::$logger->warning($warning);
         } else {
             trigger_error($warning, E_USER_WARNING);
         }
     }
     // reset the connection map (this should enable runtime changes of connection params)
     self::$connectionMap = array();
     if (isset(self::$configuration['classmap']) && is_array(self::$configuration['classmap'])) {
         PropelAutoloader::getInstance()->addClassPaths(self::$configuration['classmap']);
         PropelAutoloader::getInstance()->register();
     }
     self::$isInit = true;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:30,代码来源:Propel.php

示例14: initialize

 /**
  * Initializes Propel
  *
  * @throws     PropelException Any exceptions caught during processing will be
  *                             rethrown wrapped into a PropelException.
  */
 public static function initialize()
 {
     if (self::$configuration === null) {
         throw new PropelException("Propel cannot be initialized without " . "a valid configuration. Please check the log files " . "for further details.");
     }
     self::configureLogging();
     // Support having the configuration stored within a 'propel' sub-section or at the top-level
     if (isset(self::$configuration['propel']) && is_array(self::$configuration['propel'])) {
         self::$configuration = self::$configuration['propel'];
     }
     // reset the connection map (this should enable runtime changes of connection params)
     self::$connectionMap = array();
     foreach (self::$configuration['datasources'] as $key => $datasource) {
         if ($key != 'default' && isset($datasource['classes'])) {
             // merge the classes to the autoload map
             self::$autoloadMap = array_merge($datasource['classes'], self::$autoloadMap);
         }
     }
     self::$isInit = true;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:26,代码来源:Propel.php

示例15: getMockPropelConnection

 /**
  * @return \PropelPDO
  */
 protected function getMockPropelConnection()
 {
     if (!class_exists('Lexik\\Bundle\\TranslationBundle\\Propel\\om\\BaseFile')) {
         // classes are built in-memory.
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
         $con = $builder->build();
     } else {
         // in memory-classes already exist, create connection and SQL manually
         $dsn = 'sqlite::memory:';
         $adapter = new \DBSQLite();
         $con = new \PropelPDO($dsn, null, null);
         $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $name = 'default';
         if (!\Propel::isInit()) {
             \Propel::setConfiguration(array('datasources' => array('default' => $name)));
         }
         \Propel::setDB($name, $adapter);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
         // don't rebuild classes
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->buildSQL($con);
     }
     return $con;
 }
开发者ID:cwd,项目名称:LexikTranslationBundle,代码行数:31,代码来源:BaseUnitTestCase.php


注:本文中的Propel::isInit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。