Changeset 4336
- Timestamp:
- 05/06/08 10:20:42 (8 months ago)
- Location:
- branches/0.11
- Files:
-
- 1 added
- 6 modified
-
lib/Doctrine/Hydrator.php (modified) (1 diff)
-
lib/Doctrine/Hydrator/RecordDriver.php (modified) (3 diffs)
-
lib/Doctrine/Record.php (modified) (1 diff)
-
tests/Hydrate/CollectionInitializationTestCase.php (added)
-
tests/Query/LimitTestCase.php (modified) (3 diffs)
-
tests/Record/SynchronizeTestCase.php (modified) (2 diffs)
-
tests/run.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Hydrator.php
r4263 r4336 108 108 $listeners[$componentName] = $data['table']->getRecordListener(); 109 109 $identifierMap[$dqlAlias] = array(); 110 $prev[$dqlAlias] = array();110 $prev[$dqlAlias] = null; 111 111 $idTemplate[$dqlAlias] = ''; 112 112 } -
branches/0.11/lib/Doctrine/Hydrator/RecordDriver.php
r4332 r4336 37 37 protected $_collections = array(); 38 38 protected $_tables = array(); 39 private $_initializedRelations = array(); 39 40 40 41 public function getElementCollection($component) … … 55 56 public function initRelated($record, $name) 56 57 { 58 if ( ! isset($this->_initializedRelations[$record->getOid()][$name])) { 59 $relation = $record->getTable()->getRelation($name); 60 $coll = new Doctrine_Collection($relation->getTable()->getComponentName()); 61 $coll->setReference($record, $relation); 62 $record[$name] = $coll; 63 $this->_initializedRelations[$record->getOid()][$name] = true; 64 } 57 65 return true; 58 /*59 if ( ! is_array($record)) {60 $record[$name];61 return true;62 }63 return false;64 */65 66 } 66 67 … … 125 126 $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true); 126 127 } 128 $this->_initializedRelations = null; 129 $this->_collections = null; 130 $this->_tables = null; 127 131 } 128 132 -
branches/0.11/lib/Doctrine/Record.php
r4332 r4336 950 950 951 951 // one-to-many or one-to-one relation 952 if ($rel instanceof Doctrine_Relation_ForeignKey || 953 $rel instanceof Doctrine_Relation_LocalKey) { 952 if ($rel instanceof Doctrine_Relation_ForeignKey || $rel instanceof Doctrine_Relation_LocalKey) { 954 953 if ( ! $rel->isOneToOne()) { 955 954 // one-to-many relation found -
branches/0.11/tests/Query/LimitTestCase.php
r3884 r4336 206 206 $q = new Doctrine_Query(); 207 207 $q->from('User.Group')->limit(5); 208 208 209 209 $users = $q->execute(); 210 210 … … 212 212 213 213 $user = $this->objTable->find(5); 214 214 215 $user->Group[1]->name = "Tough guys inc."; 216 215 217 $user->Group[2]->name = "Terminators"; 216 218 … … 225 227 226 228 $this->connection->flush(); 227 229 228 230 $this->assertEqual($user->Group[0]->name, "Action Actors"); 229 231 $this->assertEqual(count($user->Group), 3); 230 231 232 233 $q = new Doctrine_Query(); 234 $q->from("User")->where("User.Group.id = ?")->orderby("User.id ASC")->limit(5); 235 236 232 233 $q = new Doctrine_Query(); 234 $q->from("User")->where("User.Group.id = ?")->orderby("User.id ASC")->limit(5); 235 237 236 $users = $q->execute(array($user->Group[1]->id)); 238 237 239 238 $this->assertEqual($users->count(), 3); 240 239 241 240 $this->connection->clear(); 242 241 $q = new Doctrine_Query(); -
branches/0.11/tests/Record/SynchronizeTestCase.php
r3884 r4336 87 87 $userArray['Phonenumber'][] = array('phonenumber' => '333 238'); 88 88 89 89 90 $user->synchronizeWithArray($userArray); 91 90 92 $this->assertEqual($user->Phonenumber->count(), 2); 91 93 $this->assertEqual($user->Phonenumber[1]->phonenumber, '333 238'); … … 96 98 { 97 99 $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); 100 98 101 $this->assertEqual($user->Phonenumber->count(), 2); 99 102 $this->assertEqual($user->Phonenumber[1]->phonenumber, '333 238'); -
branches/0.11/tests/run.php
r4334 r4336 169 169 $core->addTestCase(new Doctrine_Collection_Snapshot_TestCase()); 170 170 $core->addTestCase(new Doctrine_Hydrate_FetchMode_TestCase()); 171 $core->addTestCase(new Doctrine_Hydrate_CollectionInitialization_TestCase()); 171 172 $core->addTestCase(new Doctrine_Tokenizer_TestCase()); 172 173 $core->addTestCase(new Doctrine_BatchIterator_TestCase());