• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP GeneratorConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setGeneratorConfig

 public function setGeneratorConfig(GeneratorConfig $generatorConfig)
 {
     if ($defaultTableEngine = $generatorConfig->getBuildProperty('mysqlTableType')) {
         $this->defaultTableEngine = $defaultTableEngine;
     }
     if ($tableEngineKeyword = $generatorConfig->getBuildProperty('mysqlTableEngineKeyword')) {
         $this->tableEngineKeyword = $tableEngineKeyword;
     }
 }
开发者ID:rubensayshi,项目名称:propelsandbox,代码行数:9,代码来源:MysqlPlatform.php


示例2: getPlatform

 /**
  * Get the Platform object for this class
  *
  * @return Platform
  */
 protected function getPlatform()
 {
     static $platform;
     if (!$platform) {
         $platform = new MysqlPlatform();
         $config = new GeneratorConfig();
         $config->setBuildProperties(array('propel.mysql.tableType' => 'InnoDB'));
         $platform->setGeneratorConfig($config);
     }
     return $platform;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:16,代码来源:MysqlPlatformTest.php


示例3: testAddBehavior

 public function testAddBehavior()
 {
     $platform = new MysqlPlatform();
     $config = new GeneratorConfig();
     $config->setBuildProperties(array('propel.behavior.timestampable.class' => 'behavior.TimestampableBehavior'));
     $platform->setGeneratorConfig($config);
     $xmlToAppData = new XmlToAppData($platform, "defaultpackage", null);
     $appData = $xmlToAppData->parseFile('fixtures/bookstore/behavior-timestampable-schema.xml');
     $table = $appData->getDatabase("bookstore-behavior")->getTable('table1');
     $this->assertThat($table->getBehavior('timestampable'), $this->isInstanceOf('TimestampableBehavior'), 'addBehavior() uses the behavior class defined in build.properties');
 }
开发者ID:nextbigsound,项目名称:propel-orm,代码行数:11,代码来源:TableTest.php


示例4: getGeneratorConfig

 /**
  * Gets the GeneratorConfig object for this task or creates it on-demand.
  * @return GeneratorConfig
  */
 protected function getGeneratorConfig()
 {
     if ($this->generatorConfig === null) {
         $this->generatorConfig = new GeneratorConfig();
         $this->generatorConfig->setBuildProperties($this->getProject()->getProperties());
     }
     return $this->generatorConfig;
 }
开发者ID:nevalla,项目名称:Propel,代码行数:12,代码来源:BasePropelMigrationTask.php


示例5: main

 /**
  * Load the sql file and then execute it
  *
  * @throws BuildException
  */
 public function main()
 {
     $conf = new GeneratorConfig();
     $conf->setBuildProperties($this->getProject()->getProperties());
     $this->setBuildConnections($conf->getBuildConnections());
     if ($this->sqldbmap === null || $this->getSqlDbMap()->exists() === false) {
         throw new BuildException("You haven't provided an sqldbmap, or " . "the one you specified doesn't exist: " . $this->sqldbmap->getPath());
     }
     if ($this->url === null) {
         throw new BuildException("DSN url attribute must be set!");
     }
     // get an ordered list of SQL files to execute
     $databases = $this->getFilesToExecute();
     $this->log(sprintf('Reading SQL files...'));
     foreach ($databases as $database => $files) {
         $statements[$database] = array();
         foreach ($files as $fileName) {
             $fullFileName = $this->srcDir ? $this->srcDir . DIRECTORY_SEPARATOR . $fileName : $fileName;
             if (file_exists($fullFileName)) {
                 $this->log(sprintf('  Loading statements from "%s"', $fullFileName));
                 $fileStatements = PropelSQLParser::parseFile($fullFileName);
                 $this->log(sprintf('    %d statements to execute', count($fileStatements)), Project::MSG_VERBOSE);
                 $statements[$database] = array_merge($statements[$database], $fileStatements);
             } else {
                 $this->log(sprintf('File "%s" in sqldbmap does not exist, skipping it.', $fullFileName));
             }
         }
     }
     $successfullStatements = 0;
     $this->log(sprintf('Executing SQL statements...'));
     foreach ($statements as $database => $statementList) {
         $successfullStatements += $this->insertDatabaseSqlFiles($database, $statementList);
     }
     $this->log(sprintf('SQL execution complete. %d statements successfully executed.', $successfullStatements));
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:40,代码来源:PropelSQLExec.php


示例6: testAppendXmlNamespaceWithAutoPackage

    public function testAppendXmlNamespaceWithAutoPackage()
    {
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $config = new GeneratorConfig();
        $config->setBuildProperties(array('propel.namespace.autoPackage' => 'true'));
        $appData = new AppData();
        $appData->setGeneratorConfig($config);
        $db = new Database('testDb');
        $db->setAppData($appData);
        $table = new Table('test');
        $table->setDatabase($db);
        $table->setNamespace('\\testNs');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs" package="testPkg"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $table->setPackage('testPkg');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
    }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:31,代码来源:TableTest.php


示例7: testGetClassnameOnInexistantProperty

 /**
  * @expectedException BuildException
  */
 public function testGetClassnameOnInexistantProperty()
 {
     $generator = new GeneratorConfig();
     $generator->getClassname('propel.foo.bar');
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:8,代码来源:GeneratorConfigTest.php


示例8: testSetPackageOverridesNamespaceAutoPackage

    public function testSetPackageOverridesNamespaceAutoPackage()
    {
        $schema = <<<EOF
<database name="DB" namespace="NS1">
  <table name="table" namespace="NS2" package="foo">
    <column name="id" primaryKey="true" />
    <column name="title1" type="VARCHAR" />
  </table>
</database>
EOF;
        $config = new GeneratorConfig();
        $config->setBuildProperties(array('propel.namespace.autoPackage' => 'true'));
        $xmlToAppData = new XmlToAppData(new DefaultPlatform());
        $xmlToAppData->setGeneratorConfig($config);
        $table = $xmlToAppData->parseString($schema)->getDatabase('DB')->getTable('table');
        $this->assertEquals('foo', $table->getPackage());
    }
开发者ID:halfer,项目名称:Meshing,代码行数:17,代码来源:TableTest.php


示例9: getBuildProperty

 /**
  * Gets a specific propel (renamed) property from the build.
  *
  * @param      string $name
  * @return     mixed
  */
 protected function getBuildProperty($name)
 {
     if ($this->generatorConfig !== null) {
         return $this->generatorConfig->getBuildProperty($name);
     }
     return null;
 }
开发者ID:nextbigsound,项目名称:propel-orm,代码行数:13,代码来源:DefaultPlatform.php


示例10: getBuildProperty

 /**
  * Gets a specific propel (renamed) property from the build.
  *
  * @param  string $name
  * @return mixed
  */
 public function getBuildProperty($name)
 {
     if (null !== $this->generatorConfig) {
         return $this->generatorConfig->getBuildProperty($name);
     }
     return null;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:13,代码来源:AbstractSchemaParser.php


示例11: startElement

 /**
  * Handles opening elements of the xml file.
  */
 public function startElement($name, $attributes)
 {
     try {
         if ($name == "dataset") {
             // Clear any start/end DLL
             call_user_func(array($this->builderClazz, 'reset'));
             $this->sqlWriter->write(call_user_func(array($this->builderClazz, 'getDatabaseStartSql')));
         } else {
             // we're processing a row of data
             // where tag name is phpName e.g. <BookReader .... />
             $table = $this->database->getTableByPhpName($name);
             $columnValues = array();
             foreach ($attributes as $name => $value) {
                 $col = $table->getColumnByPhpName($name);
                 $columnValues[] = new ColumnValue($col, iconv('utf-8', $this->encoding, $value));
             }
             $data = new DataRow($table, $columnValues);
             if ($this->currTableName !== $table->getName()) {
                 // new table encountered
                 if ($this->currBuilder !== null) {
                     $this->sqlWriter->write($this->currBuilder->getTableEndSql());
                 }
                 $this->currTableName = $table->getName();
                 $this->currBuilder = $this->generatorConfig->getConfiguredBuilder($table, 'datasql');
                 $this->sqlWriter->write($this->currBuilder->getTableStartSql());
             }
             // Write the SQL
             $this->sqlWriter->write($this->currBuilder->buildRowSql($data));
         }
     } catch (Exception $e) {
         // Exceptions have traditionally not bubbled up nicely from the expat parser,
         // so we also print the stack trace here.
         print $e;
         throw $e;
     }
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:39,代码来源:XmlToDataSQL.php


示例12: testGetPLatform

 public function testGetPLatform()
 {
     $this->assertInstanceOf('CustomPlatform', $this->generatorConfig->getConfiguredPlatform());
     $this->assertInstanceOf('CustomPlatform', $this->generatorConfig->getConfiguredPlatform(null, 'default'));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:5,代码来源:CustomPlatformTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Generic类代码示例发布时间:2022-05-23
下一篇:
PHP Generator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap