diff --git a/Doctrine.php b/Doctrine.php index a3bf2e4b6..d56e09964 100644 --- a/Doctrine.php +++ b/Doctrine.php @@ -227,12 +227,66 @@ final class Doctrine { const FETCH_VHOLDER = 1; /** * FETCH RECORD + * + * Specifies that the fetch method shall return Doctrine_Record + * objects as the elements of the result set. + * + * This is the default fetchmode. */ const FETCH_RECORD = 2; /** - * FETCH ARRAY + * FETCH ARRAY */ + const FETCH_ARRAY = 3; + /** + * FETCH COLUMN + * Specifies that the fetch method shall return only a single + * requested column from the next row in the result set. + * + */ + const FETCH_COLUMN = 4; + /** + * FETCH ASSOC + * + * Specifies that the fetch method shall return each row as an + * array indexed by column name as returned in the corresponding + * result set. If the result set contains multiple columns with + * the same name, PDO::FETCH_ASSOC returns only a single value per column name. + * + */ + const FETCH_ASSOC = 5; + /** + * FETCH NAMED + * + * Specifies that the fetch method shall return each row as an array indexed + * by column name as returned in the corresponding result set. If the result set + * contains multiple columns with the same name, PDO::FETCH_NAMED returns an + * array of values per column name. + * + */ + const FETCH_NAMED = 6; + /** + * FETCH NUM + * + * Specifies that the fetch method shall return each row as an array indexed by + * column number as returned in the corresponding result set, starting at column 0. + */ + const FETCH_NUM = 7; + /** + * FETCH BOTH + * + * Specifies that the fetch method shall return each row as an array indexed by both + * column name and number as returned in the corresponding result set, starting at column 0. + */ + const FETCH_BOTH = 8; + /** + * FETCH OBJ + * + * Specifies that the fetch method shall return each row as an object with property names + * that correspond to the column names returned in the result set. + */ + const FETCH_OBJ = 9; /** diff --git a/tests/RecordTestCase.php b/tests/RecordTestCase.php index 320f43cee..56cf5f851 100644 --- a/tests/RecordTestCase.php +++ b/tests/RecordTestCase.php @@ -44,8 +44,13 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase { $this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_TDIRTY); $this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_TDIRTY); + $count = count($this->dbh); + $e->save(); + $this->assertEqual(($count + 13), $this->dbh->count()); + $this->assertEqual($e->getState(), Doctrine_Record::STATE_CLEAN); + $this->assertTrue($e->Entity[0] instanceof Entity); $this->assertTrue($e->Entity[1] instanceof Entity); @@ -61,9 +66,12 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase { $this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_CLEAN); + $this->assertTrue(is_numeric($e->id)); $e = $e->getTable()->find($e->id); - + + $this->assertTrue($e instanceof Entity); + $this->assertTrue($e->Entity[0] instanceof Entity); $this->assertTrue($e->Entity[1] instanceof Entity);