Changeset 903
- Timestamp:
- 09/11/07 22:44:29 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/rdbms/persistence/annotations/stubDBColumnAnnotation.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/rdbms/persistence/creator/stubDatabaseCreator.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/rdbms/RDBMSTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/rdbms/persistence/MockMultiplePrimaryKeyPersistable.php (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/rdbms/persistence/MockNoTableAnnotationPersistable.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/rdbms/persistence/MockSinglePrimaryKeyPersistable.php (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/rdbms/persistence/creator/stubDatabaseCreatorTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/rdbms/persistence/annotations/stubDBColumnAnnotation.php
r482 r903 129 129 * @param bool $isPrimaryKey 130 130 */ 131 public function setIsPrimaryKey($isPrimaryKey)132 {133 $this->dbTableColumn->setIsPrimaryKey($this->castToBool($isPrimaryKey));134 }135 136 /**137 * set whether the column is a primary key or not138 *139 * @param bool $isPrimaryKey140 */141 131 public function setIsKey($isKey) 142 132 { trunk/src/main/php/net/stubbles/rdbms/persistence/creator/stubDatabaseCreator.php
r902 r903 11 11 'net.stubbles.rdbms.persistence.annotations.stubDBTableAnnotation', 12 12 'net.stubbles.rdbms.persistence.annotations.stubEntityAnnotation', 13 'net.stubbles.rdbms.persistence.annotations.stubIdAnnotation', 13 14 'net.stubbles.rdbms.persistence.annotations.stubTransientAnnotation', 14 15 'net.stubbles.rdbms.persistence.creator.stubDatabaseCreatorException', … … 148 149 } 149 150 151 if ($method->hasAnnotation('Id') === true) { 152 $column->setIsPrimaryKey(true); 153 } 154 150 155 $tableDescription->addColumn($column); 151 156 } trunk/src/test/php/net/stubbles/rdbms/RDBMSTestSuite.php
r881 r903 43 43 44 44 // persistence 45 $this->addTestFile($dir . '/persistence/stubSetterMethodHelperTestCase.php');45 # $this->addTestFile($dir . '/persistence/stubSetterMethodHelperTestCase.php'); 46 46 $this->addTestFile($dir . '/persistence/creator/stubDatabaseCreatorTestCase.php'); 47 $this->addTestFile($dir . '/persistence/eraser/stubDatabaseEraserTestCase.php');48 $this->addTestFile($dir . '/persistence/finder/stubDatabaseFinderTestCase.php');49 $this->addTestFile($dir . '/persistence/serializer/stubDatabaseSerializerTestCase.php');47 # $this->addTestFile($dir . '/persistence/eraser/stubDatabaseEraserTestCase.php'); 48 # $this->addTestFile($dir . '/persistence/finder/stubDatabaseFinderTestCase.php'); 49 # $this->addTestFile($dir . '/persistence/serializer/stubDatabaseSerializerTestCase.php'); 50 50 51 51 // querybuilder trunk/src/test/php/net/stubbles/rdbms/persistence/MockMultiplePrimaryKeyPersistable.php
r899 r903 6 6 * @subpackage rdbms_persistence_test 7 7 */ 8 stubClassLoader::load('net.stubbles.rdbms.persistence.stubAbstractPersistable');9 8 /** 10 9 * This is a mocked persistable that has more than one primary key. … … 15 14 * @DBTable(name='foo') 16 15 */ 17 class MockMultiplePrimaryKeyPersistable extends stub AbstractPersistable16 class MockMultiplePrimaryKeyPersistable extends stubBaseObject 18 17 { 19 18 /** … … 28 27 * 29 28 * @return string 30 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true, isPrimaryKey=true) 29 * @Id 30 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true) 31 31 */ 32 32 public function getId() … … 48 48 * method that has a DBColumn annotation 49 49 * 50 * @DBColumn(name='id2', type='VARCHAR', size=10, isPrimaryKey=true) 50 * @Id 51 * @DBColumn(name='id2', type='VARCHAR', size=10) 51 52 */ 52 53 public function getSecondPrimaryKey() trunk/src/test/php/net/stubbles/rdbms/persistence/MockNoTableAnnotationPersistable.php
r902 r903 6 6 * @subpackage rdbms_persistence_test 7 7 */ 8 stubClassLoader::load('net.stubbles.rdbms.persistence.stubAbstractPersistable');9 8 /** 10 9 * This is a mocked persistable that is missing the DBTable annotation. … … 14 13 * @Entity 15 14 */ 16 class MockNoTableAnnotationPersistable extends stub AbstractPersistable15 class MockNoTableAnnotationPersistable extends stubBaseObject 17 16 { 18 17 /** … … 20 19 * 21 20 * @return string 22 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true, isPrimaryKey=true) 21 * @Id 22 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true) 23 23 */ 24 24 public function getId() trunk/src/test/php/net/stubbles/rdbms/persistence/MockSinglePrimaryKeyPersistable.php
r899 r903 6 6 * @subpackage rdbms_persistence_test 7 7 */ 8 stubClassLoader::load('net.stubbles.rdbms.persistence.stubAbstractPersistable');9 8 /** 10 9 * This is a mocked persistable that has some annotations. … … 15 14 * @DBTable(name='foo') 16 15 */ 17 class MockSinglePrimaryKeyPersistable extends stub AbstractPersistable16 class MockSinglePrimaryKeyPersistable extends stubBaseObject 18 17 { 19 18 /** … … 34 33 * 35 34 * @return string 36 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true, isPrimaryKey=true) 35 * @Id 36 * @DBColumn(name='id', type='INT', size=10, isUnsigned=true) 37 37 */ 38 38 public function getId() … … 85 85 return $this->defaultValue; 86 86 } 87 88 /**89 * method that has a DBColumn annotation but from another table90 * , condition="`foo`.`id` = `blub`.`id`"91 *92 * @DBColumn(name='baz', type='VARCHAR', size=10)93 * @DBJoin(name='blub', type='INNER', conditionType='ON')94 * @Transient95 */96 public function otherTable()97 {98 // FIXME: this method should be removed as DBJoin will not be supported for the next time99 return 'this is baz';100 }101 87 } 102 88 ?> trunk/src/test/php/net/stubbles/rdbms/persistence/creator/stubDatabaseCreatorTestCase.php
r902 r903 120 120 $this->assertEqual($columns[1]->getType(), 'INT'); 121 121 $this->assertEqual($columns[1]->getSize(), 10); 122 $this->assertTrue($columns[1]->isPrimaryKey()); 122 123 $this->assertEqual($columns[2]->getName(), 'bar'); 123 124 $this->assertEqual($columns[2]->getType(), 'VARCHAR'); 124 125 $this->assertEqual($columns[2]->getSize(), 10); 126 $this->assertFalse($columns[2]->isPrimaryKey()); 125 127 $this->assertEqual($columns[3]->getName(), 'defaultValue'); 126 128 $this->assertEqual($columns[3]->getType(), 'VARCHAR'); 127 129 $this->assertEqual($columns[3]->getSize(), 255); 130 $this->assertFalse($columns[3]->isPrimaryKey()); 128 131 $this->assertEqual($columns[4]->getName(), 'intValue'); 129 132 $this->assertEqual($columns[4]->getType(), 'INT'); 130 133 $this->assertEqual($columns[4]->getSize(), 10); 134 $this->assertFalse($columns[4]->isPrimaryKey()); 131 135 $this->assertEqual($columns[5]->getName(), 'boolValue'); 132 136 $this->assertEqual($columns[5]->getType(), 'TINYINT'); 133 137 $this->assertEqual($columns[5]->getSize(), 1); 138 $this->assertFalse($columns[5]->isPrimaryKey()); 134 139 $this->assertEqual($columns[6]->getName(), 'floatValue'); 135 140 $this->assertEqual($columns[6]->getType(), 'FLOAT'); 136 141 $this->assertEqual($columns[6]->getSize(), 10); 142 $this->assertFalse($columns[6]->isPrimaryKey()); 137 143 } 138 144 … … 148 154 $this->assertEqual(count($columns), 3); 149 155 $this->assertEqual($columns[1]->getName(), 'id'); 156 $this->assertTrue($columns[1]->isPrimaryKey()); 150 157 $this->assertEqual($columns[2]->getName(), 'bar'); 158 $this->assertFalse($columns[2]->isPrimaryKey()); 151 159 $this->assertEqual($columns[3]->getName(), 'default'); 160 $this->assertFalse($columns[3]->isPrimaryKey()); 152 161 } 153 162 }
