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


PHP Doctrine_Import_Schema::buildSchema方法代码示例

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


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

示例1: testTest

    public function testTest()
    {
        $yml = <<<END
---
detect_relations: true
Ticket_1118_User:
  columns:
    username: string(255)
    password: string(255)
    ticket__1118__profile_id: string

Ticket_1118_Profile:
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    name: string(255)
END;
        try {
            file_put_contents('test.yml', $yml);
            $import = new Doctrine_Import_Schema();
            $array = $import->buildSchema('test.yml', 'yml');
            // Test that ticket__1118__profile_id is changed to to be integer(4) since the primary key of
            // the relationship is set to that
            $this->assertEqual($array['Ticket_1118_User']['columns']['ticket__1118__profile_id']['type'], 'integer');
            $this->assertEqual($array['Ticket_1118_User']['columns']['ticket__1118__profile_id']['length'], '4');
            $this->pass();
        } catch (Exception $e) {
            $this->fail();
        }
        unlink('test.yml');
    }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:33,代码来源:1118TestCase.php

示例2: testTest

    public function testTest()
    {
        $yml = <<<END
---
Ticket_1527_User:
  columns:
    username:
      type: string(255)
      extra:
        test: 123
    password:
      type: string(255)
END;

        $import = new Doctrine_Import_Schema();
        $schema = $import->buildSchema($yml, 'yml');
        $this->assertEqual($schema['Ticket_1527_User']['columns']['username']['extra']['test'], '123');

        $path = dirname(__FILE__) . '/../tmp';
        $import->importSchema($yml, 'yml', $path);
        
        require_once($path . '/generated/BaseTicket_1527_User.php');
        require_once($path . '/Ticket_1527_User.php');
        $username = Doctrine::getTable('Ticket_1527_User')->getDefinitionOf('username');
        $this->assertEqual($username['extra']['test'], '123');
    }
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:26,代码来源:1527TestCase.php

示例3: testBuildSchema

 public function testBuildSchema()
 {
     $schema = new Doctrine_Import_Schema();
     $array = $schema->buildSchema('schema.yml', 'yml');
     $model = $array['SchemaTestUser'];
     $this->assertTrue(array_key_exists('connection', $model));
     $this->assertTrue(array_key_exists('className', $model));
     $this->assertTrue(array_key_exists('tableName', $model));
     $this->assertTrue(array_key_exists('columns', $model) && is_array($model['columns']));
     $this->assertTrue(array_key_exists('relations', $model) && is_array($model['relations']));
     $this->assertTrue(array_key_exists('indexes', $model) && is_array($model['indexes']));
     $this->assertTrue(array_key_exists('attributes', $model) && is_array($model['attributes']));
     $this->assertTrue(array_key_exists('templates', $model) && is_array($model['columns']));
     $this->assertTrue(array_key_exists('actAs', $model) && is_array($model['actAs']));
     $this->assertTrue(array_key_exists('options', $model) && is_array($model['options']));
     $this->assertTrue(array_key_exists('package', $model));
     $this->assertTrue(array_key_exists('inheritance', $model) && is_array($model['inheritance']));
     $this->assertTrue(array_key_exists('detect_relations', $model) && is_bool($model['detect_relations']));
     $this->assertEqual($array['AliasTest']['columns']['test_col']['name'], 'test_col as test_col_alias');
 }
开发者ID:swk,项目名称:bluebox,代码行数:20,代码来源:SchemaTestCase.php

示例4: testBuildSchema

 public function testBuildSchema()
 {
     $import = new Doctrine_Import_Schema();
     $array = $import->buildSchema('Ticket/1617_schema.yml', 'yml');
     $this->assertEqual($array['term']['columns']['language']['name'], 'lang as language');
 }
开发者ID:swk,项目名称:bluebox,代码行数:6,代码来源:1617TestCase.php

示例5: _importSchema

 /**
  * importSchema
  *
  * A method to import a Schema and translate it into a Doctrine_Record object
  *
  * @param  string $schema       The file containing the XML schema
  * @param  string $format       Format of the schema file
  * @param  string $directory    The directory where the Doctrine_Record class will be written
  * @param  array  $models       Optional array of models to import
  *
  * @return void
  */
 protected function _importSchema($schema, $format = 'yml', $directory = null, $options = array())
 {
     $schema = (array) $schema;
     $builder = new Install_Api_DoctrineBuilder();
     $builder->setTargetPath($directory);
     $builder->setOptions($options);
     $importer = new Doctrine_Import_Schema();
     $array = $importer->buildSchema($schema, $format);
     if (count($array) == 0) {
         throw new Doctrine_Import_Exception(sprintf('No ' . $format . ' schema found in ' . implode(", ", $schema)));
     }
     foreach ($array as $name => $definition) {
         $builder->buildRecord($definition);
     }
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:27,代码来源:DoctrineTool.php


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