Changeset 4294
- Timestamp:
- 04/25/08 19:55:17 (15 months ago)
- Location:
- branches/0.11
- Files:
-
- 3 modified
-
lib/Doctrine/Connection/UnitOfWork.php (modified) (2 diffs)
-
tests/ConnectionTestCase.php (modified) (1 diff)
-
tests/RecordTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Connection/UnitOfWork.php
r4293 r4294 181 181 { 182 182 if ( ! $record->exists()) { 183 throw new Doctrine_Connection_Exception("Transient records can't be deleted.");183 return; 184 184 } 185 185 … … 340 340 } 341 341 $relatedObjects = $record->get($relation->getAlias()); 342 // note: The exists() check is needed because a related object is created343 // on-the-fly on access and we need to make sure it's not such an object.344 342 if ($relatedObjects instanceof Doctrine_Record && $relatedObjects->exists() 345 343 && ! isset($deletions[$relatedObjects->getOid()])) { -
branches/0.11/tests/ConnectionTestCase.php
r4211 r4294 150 150 } 151 151 152 public function testDeleteOnTransientRecord ThrowsException()152 public function testDeleteOnTransientRecordIsIgnored() 153 153 { 154 154 $user = $this->connection->create('User'); 155 155 try { 156 156 $this->connection->unitOfWork->delete($user); 157 } catch (Doctrine_Connection_Exception $e) { 157 158 $this->fail(); 158 } catch (Doctrine_Connection_Exception $e) {159 $this->pass();160 159 } 161 160 } -
branches/0.11/tests/RecordTestCase.php
r4286 r4294 985 985 $this->assertTrue($user->delete()); 986 986 try { 987 // delete() on transient objects should just be ignored. 987 988 $user->delete(); 989 } catch (Exception $e) { 988 990 $this->fail(); 989 } catch (Exception $e) {990 $this->pass();991 991 } 992 992 }