Changeset 4930 for trunk/lib/Doctrine
- Timestamp:
- 09/12/08 11:40:23 (4 months ago)
- Location:
- trunk/lib/Doctrine
- Files:
-
- 1 added
- 1 removed
- 20 modified
-
ActiveEntity.php (modified) (3 diffs)
-
ClassMetadata.php (modified) (1 diff)
-
ClassMetadata/Factory.php (modified) (2 diffs)
-
Collection.php (modified) (4 diffs)
-
Connection/UnitOfWork.php (modified) (23 diffs)
-
Entity.php (deleted)
-
EntityManager.php (modified) (7 diffs)
-
ORM/Entity.php (added)
-
ORM/Export/Schema.php (modified) (1 diff)
-
ORM/Id/AbstractIdGenerator.php (modified) (1 diff)
-
ORM/Id/Assigned.php (modified) (1 diff)
-
ORM/Id/IdentityGenerator.php (modified) (1 diff)
-
ORM/Id/SequenceGenerator.php (modified) (1 diff)
-
ORM/Id/TableGenerator.php (modified) (1 diff)
-
ORM/Import/Schema.php (modified) (1 diff)
-
ORM/Internal/Hydration/ObjectDriver.php (modified) (2 diffs)
-
ORM/Internal/Hydration/StandardHydrator.php (modified) (1 diff)
-
ORM/Mapping/OneToOneMapping.php (modified) (1 diff)
-
ORM/Persisters/AbstractEntityPersister.php (modified) (20 diffs)
-
ORM/Persisters/JoinedSubclassPersister.php (modified) (6 diffs)
-
ORM/Persisters/StandardEntityPersister.php (modified) (4 diffs)
-
Query/Parser/AbstractSchemaName.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Doctrine/ActiveEntity.php
r4725 r4930 11 11 * @since 2.0 12 12 */ 13 class Doctrine_ActiveEntity extends Doctrine_ Entity13 class Doctrine_ActiveEntity extends Doctrine_ORM_Entity 14 14 { 15 15 /** … … 91 91 // [FIX] Prevent mapped Doctrine_Entitys from being displayed fully 92 92 foreach ($this->_values as $key => $value) { 93 if ($value instanceof Doctrine_ Entity) {93 if ($value instanceof Doctrine_ORM_Entity) { 94 94 $a[$key] = $value->toArray($deep, $prefixKey); 95 95 } else { … … 435 435 $this->_extractIdentifier(); 436 436 437 $this->_state = Doctrine_ Entity::STATE_CLEAN;437 $this->_state = Doctrine_ORM_Entity::STATE_CLEAN; 438 438 439 439 return $this; -
trunk/lib/Doctrine/ClassMetadata.php
r4925 r4930 1709 1709 * @param Entity $entity The Entity on which the event occured. 1710 1710 */ 1711 public function invokeLifecycleCallbacks($lifecycleEvent, Doctrine_ Entity $entity)1711 public function invokeLifecycleCallbacks($lifecycleEvent, Doctrine_ORM_Entity $entity) 1712 1712 { 1713 1713 foreach ($this->getLifecycleCallbacks($lifecycleEvent) as $callback) { -
trunk/lib/Doctrine/ClassMetadata/Factory.php
r4789 r4930 87 87 $loadedParentClass = false; 88 88 while ($parentClass = get_parent_class($parentClass)) { 89 if ($parentClass == 'Doctrine_ Entity') {89 if ($parentClass == 'Doctrine_ORM_Entity') { 90 90 break; 91 91 } … … 178 178 //TODO: Skip Entity types MappedSuperclass/Transient 179 179 do { 180 if ($className === 'Doctrine_ Entity') {180 if ($className === 'Doctrine_ORM_Entity') { 181 181 break; 182 182 } else if ($className == $name) { -
trunk/lib/Doctrine/Collection.php
r4915 r4930 230 230 * @return void 231 231 */ 232 public function _setOwner(Doctrine_ Entity $entity, Doctrine_ORM_Mapping_AssociationMapping $relation)232 public function _setOwner(Doctrine_ORM_Entity $entity, Doctrine_ORM_Mapping_AssociationMapping $relation) 233 233 { 234 234 $this->_owner = $entity; … … 393 393 * 394 394 */ 395 public function search(Doctrine_ Entity $record)395 public function search(Doctrine_ORM_Entity $record) 396 396 { 397 397 return array_search($record, $this->_data, true); … … 458 458 public function set($key, $value) 459 459 { 460 if ( ! $value instanceof Doctrine_ Entity) {460 if ( ! $value instanceof Doctrine_ORM_Entity) { 461 461 throw new Doctrine_Collection_Exception('Value variable in set is not an instance of Doctrine_Entity'); 462 462 } … … 476 476 { 477 477 //TODO: really only allow entities? 478 if ( ! $value instanceof Doctrine_ Entity) {478 if ( ! $value instanceof Doctrine_ORM_Entity) { 479 479 throw new Doctrine_Record_Exception('Value variable in collection is not an instance of Doctrine_Entity.'); 480 480 } -
trunk/lib/Doctrine/Connection/UnitOfWork.php
r4926 r4930 304 304 * @todo Rename to scheduleForInsert(). 305 305 */ 306 public function registerNew(Doctrine_ Entity $entity)306 public function registerNew(Doctrine_ORM_Entity $entity) 307 307 { 308 308 $oid = $entity->getOid(); … … 330 330 * Checks whether an entity is registered as new on the unit of work. 331 331 * 332 * @param Doctrine_ Entity $entity332 * @param Doctrine_ORM_Entity $entity 333 333 * @return boolean 334 334 * @todo Rename to isScheduledForInsert(). 335 335 */ 336 public function isRegisteredNew(Doctrine_ Entity $entity)336 public function isRegisteredNew(Doctrine_ORM_Entity $entity) 337 337 { 338 338 return isset($this->_newEntities[$entity->getOid()]); … … 345 345 * @param Doctrine::ORM::Entity $entity 346 346 */ 347 public function registerClean(Doctrine_ Entity $entity)347 public function registerClean(Doctrine_ORM_Entity $entity) 348 348 { 349 349 $this->addToIdentityMap($entity); … … 356 356 * @todo Rename to scheduleForUpdate(). 357 357 */ 358 public function registerDirty(Doctrine_ Entity $entity)358 public function registerDirty(Doctrine_ORM_Entity $entity) 359 359 { 360 360 $oid = $entity->getOid(); … … 381 381 * @todo Rename to isScheduledForUpdate(). 382 382 */ 383 public function isRegisteredDirty(Doctrine_ Entity $entity)383 public function isRegisteredDirty(Doctrine_ORM_Entity $entity) 384 384 { 385 385 return isset($this->_dirtyEntities[$entity->getOid()]); … … 391 391 * @todo Rename to scheduleForDelete(). 392 392 */ 393 public function registerDeleted(Doctrine_ Entity $entity)393 public function registerDeleted(Doctrine_ORM_Entity $entity) 394 394 { 395 395 $oid = $entity->getOid(); … … 421 421 * @todo Rename to isScheduledForDelete(). 422 422 */ 423 public function isRegisteredRemoved(Doctrine_ Entity $entity)423 public function isRegisteredRemoved(Doctrine_ORM_Entity $entity) 424 424 { 425 425 return isset($this->_deletedEntities[$entity->getOid()]); … … 433 433 * @return boolean whether ot not the operation was successful 434 434 */ 435 public function detach(Doctrine_ Entity $entity)435 public function detach(Doctrine_ORM_Entity $entity) 436 436 { 437 437 if ($this->isInIdentityMap($entity)) { … … 443 443 * Enter description here... 444 444 * 445 * @param Doctrine_ Entity $entity445 * @param Doctrine_ORM_Entity $entity 446 446 * @return unknown 447 447 * @todo Rename to isScheduled() 448 448 */ 449 public function isEntityRegistered(Doctrine_ Entity $entity)449 public function isEntityRegistered(Doctrine_ORM_Entity $entity) 450 450 { 451 451 $oid = $entity->getOid(); … … 489 489 * the entity in question is already managed. 490 490 */ 491 public function addToIdentityMap(Doctrine_ Entity $entity)491 public function addToIdentityMap(Doctrine_ORM_Entity $entity) 492 492 { 493 493 $idHash = $this->getIdentifierHash($entity->_identifier()); … … 501 501 } 502 502 $this->_identityMap[$className][$idHash] = $entity; 503 $entity->_state(Doctrine_ Entity::STATE_MANAGED);503 $entity->_state(Doctrine_ORM_Entity::STATE_MANAGED); 504 504 return true; 505 505 } … … 508 508 * Removes an entity from the identity map. 509 509 * 510 * @param Doctrine_ Entity $entity510 * @param Doctrine_ORM_Entity $entity 511 511 * @return unknown 512 512 */ 513 public function removeFromIdentityMap(Doctrine_ Entity $entity)513 public function removeFromIdentityMap(Doctrine_ORM_Entity $entity) 514 514 { 515 515 $idHash = $this->getIdentifierHash($entity->_identifier()); … … 566 566 * UnitOfWork. 567 567 * 568 * @param Doctrine_ Entity $entity568 * @param Doctrine_ORM_Entity $entity 569 569 * @return boolean 570 570 */ 571 public function isInIdentityMap(Doctrine_ Entity $entity)571 public function isInIdentityMap(Doctrine_ORM_Entity $entity) 572 572 { 573 573 $idHash = $this->getIdentifierHash($entity->_identifier()); … … 597 597 * Saves an entity as part of the current unit of work. 598 598 * 599 * @param Doctrine_ Entity $entity The entity to save.600 */ 601 public function save(Doctrine_ Entity $entity)599 * @param Doctrine_ORM_Entity $entity The entity to save. 600 */ 601 public function save(Doctrine_ORM_Entity $entity) 602 602 { 603 603 $insertNow = array(); … … 621 621 * the already visited entities to prevent infinite recursions. 622 622 * 623 * @param Doctrine_ Entity $entity The entity to save.623 * @param Doctrine_ORM_Entity $entity The entity to save. 624 624 * @param array $visited The already visited entities. 625 625 */ 626 private function _doSave(Doctrine_ Entity $entity, array &$visited, array &$insertNow)626 private function _doSave(Doctrine_ORM_Entity $entity, array &$visited, array &$insertNow) 627 627 { 628 628 if (isset($visited[$entity->getOid()])) { … … 634 634 $class = $entity->getClass(); 635 635 switch ($entity->_state()) { 636 case Doctrine_ Entity::STATE_MANAGED:636 case Doctrine_ORM_Entity::STATE_MANAGED: 637 637 // nothing to do for $entity 638 638 break; 639 case Doctrine_ Entity::STATE_NEW:639 case Doctrine_ORM_Entity::STATE_NEW: 640 640 $result = $class->getIdGenerator()->generate($entity); 641 641 if ($result == Doctrine_ORM_Id_AbstractIdGenerator::POST_INSERT_INDICATOR) { … … 646 646 $this->registerNew($entity); 647 647 break; 648 case Doctrine_ Entity::STATE_DETACHED:648 case Doctrine_ORM_Entity::STATE_DETACHED: 649 649 //exception? 650 650 throw new Doctrine_Exception("Behavior of save() for a detached entity " 651 651 . "is not yet defined."); 652 case Doctrine_ Entity::STATE_DELETED:652 case Doctrine_ORM_Entity::STATE_DELETED: 653 653 // $entity becomes managed again 654 654 if ($this->isRegisteredRemoved($entity)) { … … 671 671 * Deletes an entity as part of the current unit of work. 672 672 * 673 * @param Doctrine_ Entity $entity674 */ 675 public function delete(Doctrine_ Entity $entity)673 * @param Doctrine_ORM_Entity $entity 674 */ 675 public function delete(Doctrine_ORM_Entity $entity) 676 676 { 677 677 $this->_doDelete($entity, array()); … … 681 681 * Enter description here... 682 682 * 683 * @param Doctrine_ Entity $entity683 * @param Doctrine_ORM_Entity $entity 684 684 * @param array $visited 685 685 */ 686 private function _doDelete(Doctrine_ Entity $entity, array &$visited)686 private function _doDelete(Doctrine_ORM_Entity $entity, array &$visited) 687 687 { 688 688 if (isset($visited[$entity->getOid()])) { … … 694 694 $class = $entity->getClass(); 695 695 switch ($entity->_state()) { 696 case Doctrine_ Entity::STATE_NEW:697 case Doctrine_ Entity::STATE_DELETED:696 case Doctrine_ORM_Entity::STATE_NEW: 697 case Doctrine_ORM_Entity::STATE_DELETED: 698 698 // nothing to do for $entity 699 699 break; 700 case Doctrine_ Entity::STATE_MANAGED:700 case Doctrine_ORM_Entity::STATE_MANAGED: 701 701 $this->registerDeleted($entity); 702 702 break; 703 case Doctrine_ Entity::STATE_DETACHED:703 case Doctrine_ORM_Entity::STATE_DETACHED: 704 704 //exception? 705 705 throw new Doctrine_Exception("A detached entity can't be deleted."); … … 715 715 * Cascades the save operation to associated entities. 716 716 * 717 * @param Doctrine_ Entity $entity717 * @param Doctrine_ORM_Entity $entity 718 718 * @param array $visited 719 719 */ 720 private function _cascadeSave(Doctrine_ Entity $entity, array &$visited, array &$insertNow)720 private function _cascadeSave(Doctrine_ORM_Entity $entity, array &$visited, array &$insertNow) 721 721 { 722 722 foreach ($entity->getClass()->getAssociationMappings() as $assocMapping) { … … 725 725 } 726 726 $relatedEntities = $entity->get($assocMapping->getSourceFieldName()); 727 if ($relatedEntities instanceof Doctrine_ Entity) {727 if ($relatedEntities instanceof Doctrine_ORM_Entity) { 728 728 $this->_doSave($relatedEntities, $visited, $insertNow); 729 729 } else if ($relatedEntities instanceof Doctrine_Collection && … … 736 736 } 737 737 738 private function _cascadeDelete(Doctrine_ Entity $entity)738 private function _cascadeDelete(Doctrine_ORM_Entity $entity) 739 739 { 740 740 -
trunk/lib/Doctrine/EntityManager.php
r4918 r4930 281 281 * @return unknown 282 282 */ 283 public function detach(Doctrine_ Entity $entity)283 public function detach(Doctrine_ORM_Entity $entity) 284 284 { 285 285 return $this->_unitOfWork->removeFromIdentityMap($entity); … … 432 432 * @return void 433 433 */ 434 public function save(Doctrine_ Entity $entity)434 public function save(Doctrine_ORM_Entity $entity) 435 435 { 436 436 $this->_errorIfNotActiveOrClosed(); … … 447 447 * @return void 448 448 */ 449 public function delete(Doctrine_ Entity $entity)449 public function delete(Doctrine_ORM_Entity $entity) 450 450 { 451 451 $this->_errorIfNotActiveOrClosed(); … … 464 464 * @todo FIX Impl 465 465 */ 466 public function refresh(Doctrine_ Entity $entity)466 public function refresh(Doctrine_ORM_Entity $entity) 467 467 { 468 468 $this->_mergeData($entity, $entity->getRepository()->find( … … 477 477 * @return Doctrine::ORM::Entity The new entity. 478 478 */ 479 public function copy(Doctrine_ Entity $entity, $deep = false)479 public function copy(Doctrine_ORM_Entity $entity, $deep = false) 480 480 { 481 481 //... … … 561 561 * @return void 562 562 */ 563 private function _mergeData(Doctrine_ Entity $entity, array $data, $overrideLocalChanges = false) {563 private function _mergeData(Doctrine_ORM_Entity $entity, array $data, $overrideLocalChanges = false) { 564 564 if ($overrideLocalChanges) { 565 565 foreach ($data as $field => $value) { … … 583 583 * (and has it in the identity map), FALSE otherwise. 584 584 */ 585 public function contains(Doctrine_ Entity $entity)585 public function contains(Doctrine_ORM_Entity $entity) 586 586 { 587 587 return $this->_unitOfWork->isInIdentityMap($entity) && -
trunk/lib/Doctrine/ORM/Export/Schema.php
r4922 r4930 53 53 $array = array(); 54 54 55 $parent = new ReflectionClass('Doctrine_ Entity');55 $parent = new ReflectionClass('Doctrine_ORM_Entity'); 56 56 57 57 $sql = array(); -
trunk/lib/Doctrine/ORM/Id/AbstractIdGenerator.php
r4925 r4930 19 19 } 20 20 21 abstract public function generate(Doctrine_ Entity $entity);21 abstract public function generate(Doctrine_ORM_Entity $entity); 22 22 } 23 23 -
trunk/lib/Doctrine/ORM/Id/Assigned.php
r4925 r4930 11 11 * Enter description here... 12 12 * 13 * @param Doctrine_ Entity $entity13 * @param Doctrine_ORM_Entity $entity 14 14 * @return unknown 15 15 * @override 16 16 */ 17 public function generate(Doctrine_ Entity $entity)17 public function generate(Doctrine_ORM_Entity $entity) 18 18 { 19 19 if ( ! $entity->_identifier()) { -
trunk/lib/Doctrine/ORM/Id/IdentityGenerator.php
r4925 r4930 6 6 * Enter description here... 7 7 * 8 * @param Doctrine_ Entity $entity8 * @param Doctrine_ORM_Entity $entity 9 9 * @return unknown 10 10 * @override 11 11 */ 12 public function generate(Doctrine_ Entity $entity)12 public function generate(Doctrine_ORM_Entity $entity) 13 13 { 14 14 return self::POST_INSERT_INDICATOR; -
trunk/lib/Doctrine/ORM/Id/SequenceGenerator.php
r4925 r4930 13 13 * Enter description here... 14 14 * 15 * @param Doctrine_ Entity $entity15 * @param Doctrine_ORM_Entity $entity 16 16 * @override 17 17 */ 18 public function generate(Doctrine_ Entity $entity)18 public function generate(Doctrine_ORM_Entity $entity) 19 19 { 20 20 $conn = $this->_em->getConnection(); -
trunk/lib/Doctrine/ORM/Id/TableGenerator.php
r4925 r4930 9 9 { 10 10 11 public function generate(Doctrine_ Entity $entity)11 public function generate(Doctrine_ORM_Entity $entity) 12 12 { 13 13 throw new Exception("Not implemented"); -
trunk/lib/Doctrine/ORM/Import/Schema.php
r4923 r4930 45 45 'generateBaseClasses' => true, 46 46 'baseClassesDirectory' => 'generated', 47 'baseClassName' => 'Doctrine_ Entity',47 'baseClassName' => 'Doctrine_ORM_Entity', 48 48 'suffix' => '.php'); 49 49 -
trunk/lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
r4924 r4930 68 68 } 69 69 70 public function initRelatedCollection(Doctrine_ Entity $entity, $name)70 public function initRelatedCollection(Doctrine_ORM_Entity $entity, $name) 71 71 { 72 72 if ( ! isset($this->_initializedRelations[$entity->getOid()][$name])) { … … 96 96 } 97 97 98 public function addRelatedIndexedElement(Doctrine_ Entity $entity1, $property,99 Doctrine_ Entity $entity2, $indexField)98 public function addRelatedIndexedElement(Doctrine_ORM_Entity $entity1, $property, 99 Doctrine_ORM_Entity $entity2, $indexField) 100 100 { 101 101 $entity1->_internalGetReference($property)->add($entity2, $entity2->_internalGetField($indexField)); 102 102 } 103 103 104 public function addRelatedElement(Doctrine_ Entity $entity1, $property,105 Doctrine_ Entity $entity2)104 public function addRelatedElement(Doctrine_ORM_Entity $entity1, $property, 105 Doctrine_ORM_Entity $entity2) 106 106 { 107 107 $entity1->_internalGetReference($property)->add($entity2); 108 108 } 109 109 110 public function setRelatedElement(Doctrine_ Entity $entity1, $property, $entity2)110 public function setRelatedElement(Doctrine_ORM_Entity $entity1, $property, $entity2) 111 111 { 112 112 $entity1->_internalSetReference($property, $entity2, true); 113 113 } 114 114 115 public function isIndexKeyInUse(Doctrine_ Entity $entity, $assocField, $indexField)115 public function isIndexKeyInUse(Doctrine_ORM_Entity $entity, $assocField, $indexField) 116 116 { 117 117 return $entity->_internalGetReference($assocField)->contains($indexField); 118 118 } 119 119 120 public function isFieldSet(Doctrine_ Entity $entity, $field)120 public function isFieldSet(Doctrine_ORM_Entity $entity, $field) 121 121 { 122 122 return $entity->contains($field); 123 123 } 124 124 125 public function getFieldValue(Doctrine_ Entity $entity, $field)125 public function getFieldValue(Doctrine_ORM_Entity $entity, $field) 126 126 { 127 127 return $entity->_internalGetField($field); 128 128 } 129 129 130 public function getReferenceValue(Doctrine_ Entity $entity, $field)130 public function getReferenceValue(Doctrine_ORM_Entity $entity, $field) 131 131 { 132 132 return $entity->_internalGetReference($field); -
trunk/lib/Doctrine/ORM/Internal/Hydration/StandardHydrator.php
r4924 r4930 318 318 $resultPointers[$dqlAlias] =& $coll[key($coll)]; 319 319 } 320 } else if ($coll instanceof Doctrine_ Entity) {320 } else if ($coll instanceof Doctrine_ORM_Entity) { 321 321