1<?php 2/** 3 * Doctrine_Ticket_1713_TestCase 4 */ 5 6class Doctrine_Ticket_1713_TestCase extends Doctrine_UnitTestCase 7{ 8 public function prepareTables() 9 { 10 $this->tables = array('Parent1713', 'Child1713A'); 11 parent::prepareTables(); 12 } 13 14 public function prepareData() 15 { 16 $record = new Child1713A(); 17 $record['title'] = 'Child1713A'; 18 $record->save(); 19 } 20 21 public function testInheritanceSubclasses() 22 { 23 $records = Doctrine_Query::create()->query('FROM Parent1713 m'); 24 25 foreach ($records as $rec) { 26 $this->assertEqual(get_class($rec), $rec['title']); 27 } 28 } 29} 30 31class Parent1713 extends Doctrine_Record 32{ 33 public function setTableDefinition() 34 { 35 $this->setTableName('mytable'); 36 $this->hasColumn('id', 'integer', 4, array ( 37 'primary' => true, 38 'autoincrement' => true, 39 'notnull' => true, 40 )); 41 42 $this->hasColumn('title', 'string', 255, array ()); 43 $this->hasColumn('PHP_TYPE as phpType', 'integer', 11, array ()); 44 45 $this->setSubclasses( 46 array('Child1713A' => array('phpType' => 1)) 47 ); 48 } 49 50 public function setUp() 51 { 52 53 } 54} 55 56class Child1713A extends Parent1713 57{ 58 59}