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


PHP Propel::init方法代码示例

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


在下文中一共展示了Propel::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (true !== self::$isInitialized) {
         Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
         self::$isInitialized = true;
     }
 }
开发者ID:norfil,项目名称:Propel2,代码行数:7,代码来源:BookstoreTestBase.php

示例2: setUp

 protected function setUp()
 {
     Propel::init(dirname(__FILE__) . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->savedAdapter = Propel::getDB(null);
     Propel::setDB(null, new DBSQLite());
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:7,代码来源:JoinTest.php

示例3: setUp

 protected function setUp()
 {
     Propel::init(dirname(__FILE__) . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->savedAdapter = Propel::getServiceContainer()->getAdapter(null);
     Propel::getServiceContainer()->setAdapter(null, new SqliteAdapter());
 }
开发者ID:disider,项目名称:Propel2,代码行数:7,代码来源:JoinTest.php

示例4: boot

 /**
  *  Bootable Method
  *
  *  @method  boot
  *  @param   Application  $app
  *  @return  void
  */
 public function boot(Application $app)
 {
     if (!file_exists($app['propel.config_file'])) {
         throw new \InvalidArgumentException('Unable to guess Propel config file. Please, initialize the "propel.config_file" parameter.');
     }
     Propel2::init($app['propel.config_file']);
 }
开发者ID:propelorm,项目名称:PropelServiceProvider2,代码行数:14,代码来源:PropelServiceProvider.php

示例5: setUp

 /**
  * This is run before each unit test; it populates the database.
  */
 protected function setUp()
 {
     Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $this->con->beginTransaction();
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:10,代码来源:BookstoreTestBase.php

示例6: tearDown

 protected function tearDown()
 {
     if ($this->con) {
         $this->con->rollback();
     }
     parent::tearDown();
     Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:8,代码来源:PgsqlSchemaParserTest.php

示例7: setUp

 protected function setUp()
 {
     Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->c = new Criteria();
     $this->savedAdapter = Propel::getDB(null);
     Propel::setDB(null, new DBSQLite());
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:8,代码来源:CriteriaCombineTest.php

示例8: setUp

 protected function setUp()
 {
     Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->c = new Criteria();
     $defaultDatasource = Propel::getServiceContainer()->getDefaultDatasource();
     $this->savedAdapter = Propel::getServiceContainer()->getAdapter($defaultDatasource);
     Propel::getServiceContainer()->setAdapter($defaultDatasource, new SqliteAdapter());
 }
开发者ID:rouffj,项目名称:Propel2,代码行数:9,代码来源:CriteriaCombineTest.php

示例9: setUp

 /**
  * This is run before each unit test; it populates the database.
  */
 protected function setUp()
 {
     Propel::init(dirname(__FILE__) . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
     parent::setUp();
     $this->con = Propel::getConnection(PagePeer::DATABASE_NAME);
     $this->con->beginTransaction();
     CmsDataPopulator::depopulate($this->con);
     CmsDataPopulator::populate($this->con);
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:12,代码来源:CmsTestBase.php

示例10: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../config/propel.php' => config_path('propel.php')]);
     // load pregenerated config
     if (file_exists(app_path() . '/propel/config.php')) {
         Propel::init(app_path() . '/propel/config.php');
     } else {
         $this->registerRuntimeConfiguration();
     }
     if ('propel' === \Config::get('auth.driver')) {
         $this->registerPropelAuth();
     }
 }
开发者ID:julienvincent,项目名称:PropelLaravel,代码行数:18,代码来源:RuntimeServiceProvider.php

示例11: setUp

 /**
  * This is run before each unit test; it populates the database.
  */
 protected function setUp()
 {
     parent::setUp();
     if (true !== self::$isInitialized) {
         $file = __DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php';
         if (!file_exists($file)) {
             return;
         }
         Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
         self::$isInitialized = true;
     }
     $this->con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME);
     $this->con->beginTransaction();
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:17,代码来源:BookstoreTestBase.php

示例12: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     Propel::init(dirname(__FILE__) . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
 }
开发者ID:robin850,项目名称:Propel2,代码行数:5,代码来源:NamespaceTest.php

示例13: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     Propel::getServiceContainer()->closeConnections();
     Propel::init(dirname(__FILE__) . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
 }
开发者ID:robin850,项目名称:Propel2,代码行数:5,代码来源:SchemasTestBase.php

示例14: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     Propel::init(__DIR__ . '/../../../../Fixtures/bookstore/build/conf/bookstore-conf.php');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:5,代码来源:MysqlSchemaParserTest.php

示例15: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../config/propel.php' => config_path('propel.php')]);
     if (!$this->app->config['propel.propel.runtime.connections']) {
         throw new \InvalidArgumentException('Unable to guess Propel runtime config file. Please, initialize the "propel.runtime" parameter.');
     }
     // load pregenerated config
     if (file_exists(app_path() . '/propel/config.php')) {
         Propel::init(app_path() . '/propel/config.php');
         return;
     }
     // runtime configuration
     /** @var \Propel\Runtime\ServiceContainer\StandardServiceContainer */
     $serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
     $serviceContainer->closeConnections();
     $serviceContainer->checkVersion('2.0.0-dev');
     $propel_conf = $this->app->config['propel.propel'];
     $runtime_conf = $propel_conf['runtime'];
     // set connections
     foreach ($runtime_conf['connections'] as $connection_name) {
         $config = $propel_conf['database']['connections'][$connection_name];
         if (!isset($config['classname'])) {
             if ($this->app->config['app.debug']) {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\DebugPDO';
             } else {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\ConnectionWrapper';
             }
         }
         $serviceContainer->setAdapterClass($connection_name, $config['adapter']);
         $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
         $manager->setConfiguration($config + [$propel_conf['paths']]);
         $manager->setName($connection_name);
         $serviceContainer->setConnectionManager($connection_name, $manager);
     }
     $serviceContainer->setDefaultDatasource($runtime_conf['defaultConnection']);
     // set loggers
     $has_default_logger = false;
     if (isset($runtime_conf['log'])) {
         foreach ($runtime_conf['log'] as $logger_name => $logger_conf) {
             $serviceContainer->setLoggerConfiguration($logger_name, $logger_conf);
             $has_default_logger |= $logger_name === 'defaultLogger';
         }
     }
     if (!$has_default_logger) {
         $serviceContainer->setLogger('defaultLogger', \Log::getMonolog());
     }
     Propel::setServiceContainer($serviceContainer);
     $command = false;
     if (\App::runningInConsole()) {
         $input = new ArgvInput();
         $command = $input->getFirstArgument();
     }
     // skip auth driver adding if running as CLI to avoid auth model not found
     if ('propel:model:build' !== $command && 'propel' === \Config::get('auth.driver')) {
         $query_name = \Config::get('auth.user_query', false);
         if ($query_name) {
             $query = new $query_name();
             if (!$query instanceof Criteria) {
                 throw new InvalidConfigurationException("Configuration directive «auth.user_query» must contain valid classpath of user Query. Excpected type: instanceof Propel\\Runtime\\ActiveQuery\\Criteria");
             }
         } else {
             $user_class = \Config::get('auth.model');
             $query = new $user_class();
             if (!method_exists($query, 'buildCriteria')) {
                 throw new InvalidConfigurationException("Configuration directive «auth.model» must contain valid classpath of model, which has method «buildCriteria()»");
             }
             $query = $query->buildPkeyCriteria();
             $query->clear();
         }
         \Auth::extend('propel', function (\Illuminate\Foundation\Application $app) use($query) {
             return new PropelUserProvider($query, $app->make('hash'));
         });
     }
 }
开发者ID:Andrewwojownik,项目名称:propel-laravel,代码行数:79,代码来源:RuntimeServiceProvider.php


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