當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine::generateSqlFromArray方法代碼示例

本文整理匯總了PHP中Doctrine::generateSqlFromArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine::generateSqlFromArray方法的具體用法?PHP Doctrine::generateSqlFromArray怎麽用?PHP Doctrine::generateSqlFromArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine的用法示例。


在下文中一共展示了Doctrine::generateSqlFromArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testTest

 public function testTest()
 {
     $sql = Doctrine::generateSqlFromArray(array('Ticket_1923_User'));
     $this->assertEqual($sql[1], 'CREATE INDEX username_idx ON ticket_1923__user (login)');
     $sql = Doctrine::generateSqlFromArray(array('Ticket_1923_User2'));
     $this->assertEqual($sql[1], 'CREATE INDEX username2_idx ON ticket_1923__user2 (login DESC)');
 }
開發者ID:ninjapenguin,項目名稱:kohana-Doctrine-module,代碼行數:7,代碼來源:1923TestCase.php

示例2: testTest

 public function testTest()
 {
     Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
     $user = new Ticket_1764_User();
     $user->username = 'jwage';
     $user->password = 'changeme';
     $user->rate = 1;
     $this->assertEqual($user->isValid(), true);
     $sql = Doctrine::generateSqlFromArray(array('Ticket_1764_User'));
     $this->assertEqual($sql[0], 'CREATE TABLE ticket_1764__user (id INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(255), password VARCHAR(255), rate DECIMAL(18,2) NOT NULL)');
     Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE);
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:12,代碼來源:1764TestCase.php

示例3: testInheritanceGeneration

 public function testInheritanceGeneration()
 {
     $path = dirname(__FILE__) . '/import_builder_test';
     $import = new Doctrine_Import_Schema();
     $import->setOption('generateTableClasses', true);
     $import->importSchema('schema.yml', 'yml', $path);
     $models = Doctrine::loadModels($path, Doctrine::MODEL_LOADING_CONSERVATIVE);
     $schemaTestInheritanceParent = new ReflectionClass('SchemaTestInheritanceParent');
     $schemaTestInheritanceChild1 = new ReflectionClass('SchemaTestInheritanceChild1');
     $schemaTestInheritanceChild2 = new ReflectionClass('SchemaTestInheritanceChild2');
     $schemaTestInheritanceParentTable = new ReflectionClass('SchemaTestInheritanceParentTable');
     $schemaTestInheritanceChild1Table = new ReflectionClass('SchemaTestInheritanceChild1Table');
     $schemaTestInheritanceChild2Table = new ReflectionClass('SchemaTestInheritanceChild2Table');
     $this->assertTrue($schemaTestInheritanceParent->isSubClassOf('Doctrine_Record'));
     $this->assertTrue($schemaTestInheritanceParent->isSubClassOf('BaseSchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceParent->isSubClassOf('PackageSchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('BaseSchemaTestInheritanceChild1'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceChild2'));
     $this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('SchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('BaseSchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('SchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('SchemaTestInheritanceChild1'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceChild1'));
     $this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('PackageSchemaTestInheritanceParent'));
     $this->assertTrue($schemaTestInheritanceParentTable->isSubClassOf('Doctrine_Table'));
     $this->assertTrue($schemaTestInheritanceChild1Table->isSubClassOf('SchemaTestInheritanceParentTable'));
     $this->assertTrue($schemaTestInheritanceChild1Table->isSubClassOf('PackageSchemaTestInheritanceParentTable'));
     $this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('SchemaTestInheritanceParentTable'));
     $this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('PackageSchemaTestInheritanceParentTable'));
     $this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('SchemaTestInheritanceChild1Table'));
     $this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('PackageSchemaTestInheritanceChild1Table'));
     # Simple Inheritance
     $schemaTestSimpleInheritanceParent = new ReflectionClass('SchemaTestSimpleInheritanceParent');
     $schemaTestSimpleInheritanceChild = new ReflectionClass('SchemaTestSimpleInheritanceChild');
     $this->assertTrue($schemaTestSimpleInheritanceParent->hasMethod('setTableDefinition'));
     $this->assertTrue($schemaTestSimpleInheritanceChild->isSubClassOf('SchemaTestSimpleInheritanceParent'));
     # Class Table Inheritance
     $schemaTestClassTableInheritanceParent = new ReflectionClass('SchemaTestClassTableInheritanceParent');
     $schemaTestClassTableInheritanceChild = new ReflectionClass('SchemaTestClassTableInheritanceChild');
     # Concrete Inheritance
     $schemaTestConcreteInheritanceParent = new ReflectionClass('SchemaTestConcreteInheritanceParent');
     $schemaTestConcreteInheritanceChild = new ReflectionClass('SchemaTestConcreteInheritanceChild');
     # Column Aggregation Inheritance
     $schemaTestColumnAggregationInheritanceParent = new ReflectionClass('SchemaTestColumnAggregationInheritanceParent');
     $schemaTestColumnAggregationInheritanceChild = new ReflectionClass('SchemaTestColumnAggregationInheritanceChild');
     $sql = Doctrine::generateSqlFromArray(array('SchemaTestSimpleInheritanceParent', 'SchemaTestSimpleInheritanceChild'));
     $this->assertEqual(count($sql), 1);
     $this->assertEqual($sql[0], 'CREATE TABLE schema_test_simple_inheritance_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), description VARCHAR(255))');
     $sql = Doctrine::generateSqlFromArray(array('SchemaTestClassTableInheritanceParent', 'SchemaTestClassTableInheritanceChild'));
     $this->assertEqual(count($sql), 2);
     $this->assertEqual($sql[0], 'CREATE TABLE schema_test_class_table_inheritance_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255))');
     $this->assertEqual($sql[1], 'CREATE TABLE schema_test_class_table_inheritance_child (id INTEGER, title VARCHAR(255), description VARCHAR(255), PRIMARY KEY(id))');
     $sql = Doctrine::generateSqlFromArray(array('SchemaTestConcreteInheritanceParent', 'SchemaTestConcreteInheritanceChild'));
     $this->assertEqual(count($sql), 2);
     $this->assertEqual($sql[0], 'CREATE TABLE schema_test_concrete_inheritance_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255))');
     $this->assertEqual($sql[1], 'CREATE TABLE schema_test_concrete_inheritance_child (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), title VARCHAR(255), description VARCHAR(255))');
     $sql = Doctrine::generateSqlFromArray(array('SchemaTestColumnAggregationInheritanceParent', 'SchemaTestColumnAggregationInheritanceChild'));
     $this->assertEqual(count($sql), 1);
     $this->assertEqual($sql[0], 'CREATE TABLE schema_test_column_aggregation_inheritance_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), type VARCHAR(255), title VARCHAR(255), description VARCHAR(255))');
     Doctrine_Lib::removeDirectories($path);
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:62,代碼來源:BuilderTestCase.php


注:本文中的Doctrine::generateSqlFromArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。