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


PHP PropelQuickBuilder::buildSQL方法代码示例

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


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

示例1: 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

示例2: loadAndBuild

 protected function loadAndBuild()
 {
     $this->loadPropelQuickBuilder();
     if (!class_exists('Glorpen\\Propel\\PropelBundle\\Tests\\Fixtures\\Model\\Book', false)) {
         $builder = new \PropelQuickBuilder();
         $builder->getConfig()->setBuildProperty('behaviorEventClass', 'Behaviors.EventBehavior');
         $builder->getConfig()->setBuildProperty('behaviorExtendClass', 'Behaviors.ExtendBehavior');
         $builder->setSchema(static::$schema);
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
         file_put_contents("/tmp/a.php", $builder->getClasses());
         $builder->build();
         $con = new EventPropelPDO('sqlite::memory:');
         $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $name = $builder->getDatabase()->getName();
         \Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
         $builder->buildSQL($con);
     }
 }
开发者ID:karser,项目名称:GlorpenPropelBundle,代码行数:19,代码来源:PropelTestCase.php


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