moved Entity
This commit is contained in:
parent
9c11c36bb3
commit
18ec38eef7
@ -10,7 +10,7 @@
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Doctrine_ActiveEntity extends Doctrine_Entity
|
||||
class Doctrine_ActiveEntity extends Doctrine_ORM_Entity
|
||||
{
|
||||
/**
|
||||
* Saves the current state of the entity into the database.
|
||||
@ -90,7 +90,7 @@ class Doctrine_ActiveEntity extends Doctrine_Entity
|
||||
|
||||
// [FIX] Prevent mapped Doctrine_Entitys from being displayed fully
|
||||
foreach ($this->_values as $key => $value) {
|
||||
if ($value instanceof Doctrine_Entity) {
|
||||
if ($value instanceof Doctrine_ORM_Entity) {
|
||||
$a[$key] = $value->toArray($deep, $prefixKey);
|
||||
} else {
|
||||
$a[$key] = $value;
|
||||
@ -434,7 +434,7 @@ class Doctrine_ActiveEntity extends Doctrine_Entity
|
||||
|
||||
$this->_extractIdentifier();
|
||||
|
||||
$this->_state = Doctrine_Entity::STATE_CLEAN;
|
||||
$this->_state = Doctrine_ORM_Entity::STATE_CLEAN;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
|
||||
* @param string $event The lifecycle event.
|
||||
* @param Entity $entity The Entity on which the event occured.
|
||||
*/
|
||||
public function invokeLifecycleCallbacks($lifecycleEvent, Doctrine_Entity $entity)
|
||||
public function invokeLifecycleCallbacks($lifecycleEvent, Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
foreach ($this->getLifecycleCallbacks($lifecycleEvent) as $callback) {
|
||||
$entity->$callback();
|
||||
|
@ -86,7 +86,7 @@ class Doctrine_ClassMetadata_Factory
|
||||
$parentClasses = array();
|
||||
$loadedParentClass = false;
|
||||
while ($parentClass = get_parent_class($parentClass)) {
|
||||
if ($parentClass == 'Doctrine_Entity') {
|
||||
if ($parentClass == 'Doctrine_ORM_Entity') {
|
||||
break;
|
||||
}
|
||||
if (isset($classes[$parentClass])) {
|
||||
@ -177,7 +177,7 @@ class Doctrine_ClassMetadata_Factory
|
||||
// get parent classes
|
||||
//TODO: Skip Entity types MappedSuperclass/Transient
|
||||
do {
|
||||
if ($className === 'Doctrine_Entity') {
|
||||
if ($className === 'Doctrine_ORM_Entity') {
|
||||
break;
|
||||
} else if ($className == $name) {
|
||||
continue;
|
||||
|
@ -229,7 +229,7 @@ class Doctrine_Collection implements Countable, IteratorAggregate, Serializable,
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _setOwner(Doctrine_Entity $entity, Doctrine_ORM_Mapping_AssociationMapping $relation)
|
||||
public function _setOwner(Doctrine_ORM_Entity $entity, Doctrine_ORM_Mapping_AssociationMapping $relation)
|
||||
{
|
||||
$this->_owner = $entity;
|
||||
$this->_association = $relation;
|
||||
@ -392,7 +392,7 @@ class Doctrine_Collection implements Countable, IteratorAggregate, Serializable,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function search(Doctrine_Entity $record)
|
||||
public function search(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
return array_search($record, $this->_data, true);
|
||||
}
|
||||
@ -457,7 +457,7 @@ class Doctrine_Collection implements Countable, IteratorAggregate, Serializable,
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
if ( ! $value instanceof Doctrine_Entity) {
|
||||
if ( ! $value instanceof Doctrine_ORM_Entity) {
|
||||
throw new Doctrine_Collection_Exception('Value variable in set is not an instance of Doctrine_Entity');
|
||||
}
|
||||
$this->_data[$key] = $value;
|
||||
@ -475,7 +475,7 @@ class Doctrine_Collection implements Countable, IteratorAggregate, Serializable,
|
||||
public function add($value, $key = null)
|
||||
{
|
||||
//TODO: really only allow entities?
|
||||
if ( ! $value instanceof Doctrine_Entity) {
|
||||
if ( ! $value instanceof Doctrine_ORM_Entity) {
|
||||
throw new Doctrine_Record_Exception('Value variable in collection is not an instance of Doctrine_Entity.');
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
*
|
||||
* @todo Rename to scheduleForInsert().
|
||||
*/
|
||||
public function registerNew(Doctrine_Entity $entity)
|
||||
public function registerNew(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$oid = $entity->getOid();
|
||||
|
||||
@ -329,11 +329,11 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Checks whether an entity is registered as new on the unit of work.
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return boolean
|
||||
* @todo Rename to isScheduledForInsert().
|
||||
*/
|
||||
public function isRegisteredNew(Doctrine_Entity $entity)
|
||||
public function isRegisteredNew(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return isset($this->_newEntities[$entity->getOid()]);
|
||||
}
|
||||
@ -344,7 +344,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
*
|
||||
* @param Doctrine::ORM::Entity $entity
|
||||
*/
|
||||
public function registerClean(Doctrine_Entity $entity)
|
||||
public function registerClean(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->addToIdentityMap($entity);
|
||||
}
|
||||
@ -355,7 +355,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
* @param Doctrine::ORM::Entity $entity
|
||||
* @todo Rename to scheduleForUpdate().
|
||||
*/
|
||||
public function registerDirty(Doctrine_Entity $entity)
|
||||
public function registerDirty(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$oid = $entity->getOid();
|
||||
if ( ! $entity->_identifier()) {
|
||||
@ -380,7 +380,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
* @return boolean
|
||||
* @todo Rename to isScheduledForUpdate().
|
||||
*/
|
||||
public function isRegisteredDirty(Doctrine_Entity $entity)
|
||||
public function isRegisteredDirty(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return isset($this->_dirtyEntities[$entity->getOid()]);
|
||||
}
|
||||
@ -390,7 +390,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
*
|
||||
* @todo Rename to scheduleForDelete().
|
||||
*/
|
||||
public function registerDeleted(Doctrine_Entity $entity)
|
||||
public function registerDeleted(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$oid = $entity->getOid();
|
||||
if ( ! $this->isInIdentityMap($entity)) {
|
||||
@ -420,7 +420,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
* @return boolean
|
||||
* @todo Rename to isScheduledForDelete().
|
||||
*/
|
||||
public function isRegisteredRemoved(Doctrine_Entity $entity)
|
||||
public function isRegisteredRemoved(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return isset($this->_deletedEntities[$entity->getOid()]);
|
||||
}
|
||||
@ -432,7 +432,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
* @param integer $oid object identifier
|
||||
* @return boolean whether ot not the operation was successful
|
||||
*/
|
||||
public function detach(Doctrine_Entity $entity)
|
||||
public function detach(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
if ($this->isInIdentityMap($entity)) {
|
||||
$this->removeFromIdentityMap($entity);
|
||||
@ -442,11 +442,11 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return unknown
|
||||
* @todo Rename to isScheduled()
|
||||
*/
|
||||
public function isEntityRegistered(Doctrine_Entity $entity)
|
||||
public function isEntityRegistered(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$oid = $entity->getOid();
|
||||
return isset($this->_newEntities[$oid]) ||
|
||||
@ -488,7 +488,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
* @return boolean TRUE if the registration was successful, FALSE if the identity of
|
||||
* the entity in question is already managed.
|
||||
*/
|
||||
public function addToIdentityMap(Doctrine_Entity $entity)
|
||||
public function addToIdentityMap(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$idHash = $this->getIdentifierHash($entity->_identifier());
|
||||
if ($idHash === '') {
|
||||
@ -500,17 +500,17 @@ class Doctrine_Connection_UnitOfWork
|
||||
return false;
|
||||
}
|
||||
$this->_identityMap[$className][$idHash] = $entity;
|
||||
$entity->_state(Doctrine_Entity::STATE_MANAGED);
|
||||
$entity->_state(Doctrine_ORM_Entity::STATE_MANAGED);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an entity from the identity map.
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return unknown
|
||||
*/
|
||||
public function removeFromIdentityMap(Doctrine_Entity $entity)
|
||||
public function removeFromIdentityMap(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$idHash = $this->getIdentifierHash($entity->_identifier());
|
||||
if ($idHash === '') {
|
||||
@ -565,10 +565,10 @@ class Doctrine_Connection_UnitOfWork
|
||||
* Checks whether an entity is registered in the identity map of the
|
||||
* UnitOfWork.
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInIdentityMap(Doctrine_Entity $entity)
|
||||
public function isInIdentityMap(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$idHash = $this->getIdentifierHash($entity->_identifier());
|
||||
if ($idHash === '') {
|
||||
@ -596,9 +596,9 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Saves an entity as part of the current unit of work.
|
||||
*
|
||||
* @param Doctrine_Entity $entity The entity to save.
|
||||
* @param Doctrine_ORM_Entity $entity The entity to save.
|
||||
*/
|
||||
public function save(Doctrine_Entity $entity)
|
||||
public function save(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$insertNow = array();
|
||||
$visited = array();
|
||||
@ -620,10 +620,10 @@ class Doctrine_Connection_UnitOfWork
|
||||
* This method is internally called during save() cascades as it tracks
|
||||
* the already visited entities to prevent infinite recursions.
|
||||
*
|
||||
* @param Doctrine_Entity $entity The entity to save.
|
||||
* @param Doctrine_ORM_Entity $entity The entity to save.
|
||||
* @param array $visited The already visited entities.
|
||||
*/
|
||||
private function _doSave(Doctrine_Entity $entity, array &$visited, array &$insertNow)
|
||||
private function _doSave(Doctrine_ORM_Entity $entity, array &$visited, array &$insertNow)
|
||||
{
|
||||
if (isset($visited[$entity->getOid()])) {
|
||||
return; // Prevent infinite recursion
|
||||
@ -633,10 +633,10 @@ class Doctrine_Connection_UnitOfWork
|
||||
|
||||
$class = $entity->getClass();
|
||||
switch ($entity->_state()) {
|
||||
case Doctrine_Entity::STATE_MANAGED:
|
||||
case Doctrine_ORM_Entity::STATE_MANAGED:
|
||||
// nothing to do for $entity
|
||||
break;
|
||||
case Doctrine_Entity::STATE_NEW:
|
||||
case Doctrine_ORM_Entity::STATE_NEW:
|
||||
$result = $class->getIdGenerator()->generate($entity);
|
||||
if ($result == Doctrine_ORM_Id_AbstractIdGenerator::POST_INSERT_INDICATOR) {
|
||||
$insertNow[$entity->getOid()] = $entity;
|
||||
@ -645,11 +645,11 @@ class Doctrine_Connection_UnitOfWork
|
||||
}
|
||||
$this->registerNew($entity);
|
||||
break;
|
||||
case Doctrine_Entity::STATE_DETACHED:
|
||||
case Doctrine_ORM_Entity::STATE_DETACHED:
|
||||
//exception?
|
||||
throw new Doctrine_Exception("Behavior of save() for a detached entity "
|
||||
. "is not yet defined.");
|
||||
case Doctrine_Entity::STATE_DELETED:
|
||||
case Doctrine_ORM_Entity::STATE_DELETED:
|
||||
// $entity becomes managed again
|
||||
if ($this->isRegisteredRemoved($entity)) {
|
||||
//TODO: better a method for this?
|
||||
@ -670,9 +670,9 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Deletes an entity as part of the current unit of work.
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
*/
|
||||
public function delete(Doctrine_Entity $entity)
|
||||
public function delete(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_doDelete($entity, array());
|
||||
}
|
||||
@ -680,10 +680,10 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @param array $visited
|
||||
*/
|
||||
private function _doDelete(Doctrine_Entity $entity, array &$visited)
|
||||
private function _doDelete(Doctrine_ORM_Entity $entity, array &$visited)
|
||||
{
|
||||
if (isset($visited[$entity->getOid()])) {
|
||||
return; // Prevent infinite recursion
|
||||
@ -693,14 +693,14 @@ class Doctrine_Connection_UnitOfWork
|
||||
|
||||
$class = $entity->getClass();
|
||||
switch ($entity->_state()) {
|
||||
case Doctrine_Entity::STATE_NEW:
|
||||
case Doctrine_Entity::STATE_DELETED:
|
||||
case Doctrine_ORM_Entity::STATE_NEW:
|
||||
case Doctrine_ORM_Entity::STATE_DELETED:
|
||||
// nothing to do for $entity
|
||||
break;
|
||||
case Doctrine_Entity::STATE_MANAGED:
|
||||
case Doctrine_ORM_Entity::STATE_MANAGED:
|
||||
$this->registerDeleted($entity);
|
||||
break;
|
||||
case Doctrine_Entity::STATE_DETACHED:
|
||||
case Doctrine_ORM_Entity::STATE_DETACHED:
|
||||
//exception?
|
||||
throw new Doctrine_Exception("A detached entity can't be deleted.");
|
||||
default:
|
||||
@ -714,17 +714,17 @@ class Doctrine_Connection_UnitOfWork
|
||||
/**
|
||||
* Cascades the save operation to associated entities.
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @param array $visited
|
||||
*/
|
||||
private function _cascadeSave(Doctrine_Entity $entity, array &$visited, array &$insertNow)
|
||||
private function _cascadeSave(Doctrine_ORM_Entity $entity, array &$visited, array &$insertNow)
|
||||
{
|
||||
foreach ($entity->getClass()->getAssociationMappings() as $assocMapping) {
|
||||
if ( ! $assocMapping->isCascadeSave()) {
|
||||
continue;
|
||||
}
|
||||
$relatedEntities = $entity->get($assocMapping->getSourceFieldName());
|
||||
if ($relatedEntities instanceof Doctrine_Entity) {
|
||||
if ($relatedEntities instanceof Doctrine_ORM_Entity) {
|
||||
$this->_doSave($relatedEntities, $visited, $insertNow);
|
||||
} else if ($relatedEntities instanceof Doctrine_Collection &&
|
||||
count($relatedEntities) > 0) {
|
||||
@ -735,7 +735,7 @@ class Doctrine_Connection_UnitOfWork
|
||||
}
|
||||
}
|
||||
|
||||
private function _cascadeDelete(Doctrine_Entity $entity)
|
||||
private function _cascadeDelete(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class Doctrine_EntityManager
|
||||
* @param Doctrine_Entity $entity
|
||||
* @return unknown
|
||||
*/
|
||||
public function detach(Doctrine_Entity $entity)
|
||||
public function detach(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return $this->_unitOfWork->removeFromIdentityMap($entity);
|
||||
}
|
||||
@ -431,7 +431,7 @@ class Doctrine_EntityManager
|
||||
* @param Doctrine::ORM::Entity $entity
|
||||
* @return void
|
||||
*/
|
||||
public function save(Doctrine_Entity $entity)
|
||||
public function save(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_errorIfNotActiveOrClosed();
|
||||
$this->_unitOfWork->save($entity);
|
||||
@ -446,7 +446,7 @@ class Doctrine_EntityManager
|
||||
* @param Doctrine::ORM::Entity $entity
|
||||
* @return void
|
||||
*/
|
||||
public function delete(Doctrine_Entity $entity)
|
||||
public function delete(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_errorIfNotActiveOrClosed();
|
||||
$this->_unitOfWork->delete($entity);
|
||||
@ -463,7 +463,7 @@ class Doctrine_EntityManager
|
||||
* @return void
|
||||
* @todo FIX Impl
|
||||
*/
|
||||
public function refresh(Doctrine_Entity $entity)
|
||||
public function refresh(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_mergeData($entity, $entity->getRepository()->find(
|
||||
$entity->identifier(), Doctrine_Query::HYDRATE_ARRAY),
|
||||
@ -476,7 +476,7 @@ class Doctrine_EntityManager
|
||||
* @param Doctrine::ORM::Entity $entity The entity to copy.
|
||||
* @return Doctrine::ORM::Entity The new entity.
|
||||
*/
|
||||
public function copy(Doctrine_Entity $entity, $deep = false)
|
||||
public function copy(Doctrine_ORM_Entity $entity, $deep = false)
|
||||
{
|
||||
//...
|
||||
}
|
||||
@ -560,7 +560,7 @@ class Doctrine_EntityManager
|
||||
* @param boolean $overrideLocalChanges
|
||||
* @return void
|
||||
*/
|
||||
private function _mergeData(Doctrine_Entity $entity, array $data, $overrideLocalChanges = false) {
|
||||
private function _mergeData(Doctrine_ORM_Entity $entity, array $data, $overrideLocalChanges = false) {
|
||||
if ($overrideLocalChanges) {
|
||||
foreach ($data as $field => $value) {
|
||||
$entity->_internalSetField($field, $value);
|
||||
@ -582,7 +582,7 @@ class Doctrine_EntityManager
|
||||
* @return boolean TRUE if this EntityManager currently manages the given entity
|
||||
* (and has it in the identity map), FALSE otherwise.
|
||||
*/
|
||||
public function contains(Doctrine_Entity $entity)
|
||||
public function contains(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return $this->_unitOfWork->isInIdentityMap($entity) &&
|
||||
! $this->_unitOfWork->isRegisteredRemoved($entity);
|
||||
|
@ -40,7 +40,7 @@
|
||||
* @since 2.0
|
||||
* @version $Revision: 4342 $
|
||||
*/
|
||||
abstract class Doctrine_Entity implements ArrayAccess, Serializable
|
||||
abstract class Doctrine_ORM_Entity implements ArrayAccess, Serializable
|
||||
{
|
||||
/**
|
||||
* MANAGED
|
||||
@ -276,7 +276,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
|
||||
$this->_data = array_merge($this->_data, $this->_id);
|
||||
|
||||
foreach ($this->_data as $k => $v) {
|
||||
if ($v instanceof Doctrine_Entity && $this->_class->getTypeOfField($k) != 'object') {
|
||||
if ($v instanceof Doctrine_ORM_Entity && $this->_class->getTypeOfField($k) != 'object') {
|
||||
unset($vars['_data'][$k]);
|
||||
} else if ($v === Doctrine_Null::$INSTANCE) {
|
||||
unset($vars['_data'][$k]);
|
||||
@ -541,7 +541,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
|
||||
|
||||
$rel = $this->_class->getAssociationMapping($name);
|
||||
|
||||
if ($rel->isOneToOne() && ! $value instanceof Doctrine_Entity) {
|
||||
if ($rel->isOneToOne() && ! $value instanceof Doctrine_ORM_Entity) {
|
||||
throw Doctrine_Entity_Exception::invalidValueForOneToOneReference();
|
||||
} else if (($rel->isOneToMany() || $rel->isManyToMany()) && ! $value instanceof Doctrine_Collection) {
|
||||
throw Doctrine_Entity_Exception::invalidValueForOneToManyReference();
|
@ -52,7 +52,7 @@ class Doctrine_Export_Schema
|
||||
|
||||
$array = array();
|
||||
|
||||
$parent = new ReflectionClass('Doctrine_Entity');
|
||||
$parent = new ReflectionClass('Doctrine_ORM_Entity');
|
||||
|
||||
$sql = array();
|
||||
$fks = array();
|
||||
|
@ -18,7 +18,7 @@ abstract class Doctrine_ORM_Id_AbstractIdGenerator
|
||||
$this->_em = $em;
|
||||
}
|
||||
|
||||
abstract public function generate(Doctrine_Entity $entity);
|
||||
abstract public function generate(Doctrine_ORM_Entity $entity);
|
||||
}
|
||||
|
||||
?>
|
@ -10,11 +10,11 @@ class Doctrine_ORM_Id_Assigned extends Doctrine_ORM_Id_AbstractIdGenerator
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return unknown
|
||||
* @override
|
||||
*/
|
||||
public function generate(Doctrine_Entity $entity)
|
||||
public function generate(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
if ( ! $entity->_identifier()) {
|
||||
throw Doctrine_IdException::missingAssignedId($entity);
|
||||
|
@ -5,11 +5,11 @@ class Doctrine_ORM_Id_IdentityGenerator extends Doctrine_ORM_Id_AbstractIdGenera
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @return unknown
|
||||
* @override
|
||||
*/
|
||||
public function generate(Doctrine_Entity $entity)
|
||||
public function generate(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return self::POST_INSERT_INDICATOR;
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_Id_AbstractIdGenera
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Doctrine_Entity $entity
|
||||
* @param Doctrine_ORM_Entity $entity
|
||||
* @override
|
||||
*/
|
||||
public function generate(Doctrine_Entity $entity)
|
||||
public function generate(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$conn = $this->_em->getConnection();
|
||||
$sql = $conn->getDatabasePlatform()->getSequenceNextValSql($this->_sequenceName);
|
||||
|
@ -8,7 +8,7 @@
|
||||
class Doctrine_ORM_Id_TableGenerator extends Doctrine_ORM_Id_AbstractIdGenerator
|
||||
{
|
||||
|
||||
public function generate(Doctrine_Entity $entity)
|
||||
public function generate(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
throw new Exception("Not implemented");
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class Doctrine_Import_Schema
|
||||
'packagesPath' => '',
|
||||
'generateBaseClasses' => true,
|
||||
'baseClassesDirectory' => 'generated',
|
||||
'baseClassName' => 'Doctrine_Entity',
|
||||
'baseClassName' => 'Doctrine_ORM_Entity',
|
||||
'suffix' => '.php');
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver
|
||||
}
|
||||
}
|
||||
|
||||
public function initRelatedCollection(Doctrine_Entity $entity, $name)
|
||||
public function initRelatedCollection(Doctrine_ORM_Entity $entity, $name)
|
||||
{
|
||||
if ( ! isset($this->_initializedRelations[$entity->getOid()][$name])) {
|
||||
$relation = $entity->getClass()->getAssociationMapping($name);
|
||||
@ -95,39 +95,39 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver
|
||||
return $this->_em->createEntity($className, $data);
|
||||
}
|
||||
|
||||
public function addRelatedIndexedElement(Doctrine_Entity $entity1, $property,
|
||||
Doctrine_Entity $entity2, $indexField)
|
||||
public function addRelatedIndexedElement(Doctrine_ORM_Entity $entity1, $property,
|
||||
Doctrine_ORM_Entity $entity2, $indexField)
|
||||
{
|
||||
$entity1->_internalGetReference($property)->add($entity2, $entity2->_internalGetField($indexField));
|
||||
}
|
||||
|
||||
public function addRelatedElement(Doctrine_Entity $entity1, $property,
|
||||
Doctrine_Entity $entity2)
|
||||
public function addRelatedElement(Doctrine_ORM_Entity $entity1, $property,
|
||||
Doctrine_ORM_Entity $entity2)
|
||||
{
|
||||
$entity1->_internalGetReference($property)->add($entity2);
|
||||
}
|
||||
|
||||
public function setRelatedElement(Doctrine_Entity $entity1, $property, $entity2)
|
||||
public function setRelatedElement(Doctrine_ORM_Entity $entity1, $property, $entity2)
|
||||
{
|
||||
$entity1->_internalSetReference($property, $entity2, true);
|
||||
}
|
||||
|
||||
public function isIndexKeyInUse(Doctrine_Entity $entity, $assocField, $indexField)
|
||||
public function isIndexKeyInUse(Doctrine_ORM_Entity $entity, $assocField, $indexField)
|
||||
{
|
||||
return $entity->_internalGetReference($assocField)->contains($indexField);
|
||||
}
|
||||
|
||||
public function isFieldSet(Doctrine_Entity $entity, $field)
|
||||
public function isFieldSet(Doctrine_ORM_Entity $entity, $field)
|
||||
{
|
||||
return $entity->contains($field);
|
||||
}
|
||||
|
||||
public function getFieldValue(Doctrine_Entity $entity, $field)
|
||||
public function getFieldValue(Doctrine_ORM_Entity $entity, $field)
|
||||
{
|
||||
return $entity->_internalGetField($field);
|
||||
}
|
||||
|
||||
public function getReferenceValue(Doctrine_Entity $entity, $field)
|
||||
public function getReferenceValue(Doctrine_ORM_Entity $entity, $field)
|
||||
{
|
||||
return $entity->_internalGetReference($field);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ class Doctrine_ORM_Internal_Hydration_StandardHydrator extends Doctrine_ORM_Inte
|
||||
end($coll);
|
||||
$resultPointers[$dqlAlias] =& $coll[key($coll)];
|
||||
}
|
||||
} else if ($coll instanceof Doctrine_Entity) {
|
||||
} else if ($coll instanceof Doctrine_ORM_Entity) {
|
||||
$resultPointers[$dqlAlias] = $coll;
|
||||
} else if (count($coll) > 0) {
|
||||
$resultPointers[$dqlAlias] = $coll->getLast();
|
||||
|
@ -133,7 +133,7 @@ class Doctrine_ORM_Mapping_OneToOneMapping extends Doctrine_ORM_Mapping_Associat
|
||||
* @param Doctrine::ORM::Entity $entity
|
||||
* @return void
|
||||
*/
|
||||
public function lazyLoadFor(Doctrine_Entity $entity)
|
||||
public function lazyLoadFor(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
if ($entity->getClassName() != $this->_sourceClass->getClassName()) {
|
||||
//error?
|
||||
|
@ -89,7 +89,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine::ORM::Entity $entity The entity to insert.
|
||||
* @return void
|
||||
*/
|
||||
public function insert(Doctrine_Entity $entity)
|
||||
public function insert(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$insertData = array();
|
||||
$class = $entity->getClass();
|
||||
@ -149,7 +149,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine::ORM::Entity $entity The entity to update.
|
||||
* @return void
|
||||
*/
|
||||
public function update(Doctrine_Entity $entity)
|
||||
public function update(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$dataChangeSet = $entity->_getDataChangeSet();
|
||||
$referenceChangeSet = $entity->_getReferenceChangeSet();
|
||||
@ -175,7 +175,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine::ORM::Entity $entity The entity to delete.
|
||||
* @return void
|
||||
*/
|
||||
public function delete(Doctrine_Entity $entity)
|
||||
public function delete(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
//TODO: perform delete
|
||||
}
|
||||
@ -334,14 +334,14 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @throws PDOException if something went wrong at database level
|
||||
* @return void
|
||||
*/
|
||||
protected function _deleteComposites(Doctrine_Entity $record)
|
||||
protected function _deleteComposites(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$classMetadata = $this->_classMetadata;
|
||||
foreach ($classMetadata->getRelations() as $fk) {
|
||||
if ($fk->isComposite()) {
|
||||
$obj = $record->get($fk->getAlias());
|
||||
if ($obj instanceof Doctrine_Entity &&
|
||||
$obj->_state() != Doctrine_Entity::STATE_LOCKED) {
|
||||
if ($obj instanceof Doctrine_ORM_Entity &&
|
||||
$obj->_state() != Doctrine_ORM_Entity::STATE_LOCKED) {
|
||||
$obj->delete($this->_mapper->getConnection());
|
||||
}
|
||||
}
|
||||
@ -381,7 +381,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine_Connection $conn The connection to use. Will default to the mapper's
|
||||
* connection.
|
||||
*/
|
||||
public function save(Doctrine_Entity $record)
|
||||
public function save(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
if ( ! ($record instanceof $this->_domainClassName)) {
|
||||
throw new Doctrine_Mapper_Exception("Mapper of type " . $this->_domainClassName . "
|
||||
@ -393,11 +393,11 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
}
|
||||
|
||||
$state = $record->_state();
|
||||
if ($state === Doctrine_Entity::STATE_LOCKED) {
|
||||
if ($state === Doctrine_ORM_Entity::STATE_LOCKED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$record->_state(Doctrine_Entity::STATE_LOCKED);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_LOCKED);
|
||||
|
||||
try {
|
||||
$conn->beginInternalTransaction();
|
||||
@ -412,7 +412,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
}
|
||||
|
||||
$state = $record->_state();
|
||||
$record->_state(Doctrine_Entity::STATE_LOCKED);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_LOCKED);
|
||||
|
||||
foreach ($saveLater as $fk) {
|
||||
$alias = $fk->getAlias();
|
||||
@ -443,21 +443,21 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
*
|
||||
* @param Doctrine_Entity $record The entity to insert/update.
|
||||
*/
|
||||
protected function _insertOrUpdate(Doctrine_Entity $record)
|
||||
protected function _insertOrUpdate(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
//$record->preSave();
|
||||
//$this->notifyEntityListeners($record, 'preSave', Doctrine_Event::RECORD_SAVE);
|
||||
|
||||
switch ($record->_state()) {
|
||||
case Doctrine_Entity::STATE_TDIRTY:
|
||||
case Doctrine_ORM_Entity::STATE_TDIRTY:
|
||||
$this->_insert($record);
|
||||
break;
|
||||
case Doctrine_Entity::STATE_DIRTY:
|
||||
case Doctrine_Entity::STATE_PROXY:
|
||||
case Doctrine_ORM_Entity::STATE_DIRTY:
|
||||
case Doctrine_ORM_Entity::STATE_PROXY:
|
||||
$this->_update($record);
|
||||
break;
|
||||
case Doctrine_Entity::STATE_CLEAN:
|
||||
case Doctrine_Entity::STATE_TCLEAN:
|
||||
case Doctrine_ORM_Entity::STATE_CLEAN:
|
||||
case Doctrine_ORM_Entity::STATE_TCLEAN:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
@ -472,7 +472,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine_Entity $record
|
||||
* @return void
|
||||
*/
|
||||
public function saveSingleRecord(Doctrine_Entity $record)
|
||||
public function saveSingleRecord(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$this->_insertOrUpdate($record);
|
||||
}
|
||||
@ -483,7 +483,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @throws PDOException if something went wrong at database level
|
||||
* @param Doctrine_Entity $record
|
||||
*/
|
||||
protected function _saveRelated(Doctrine_Entity $record)
|
||||
protected function _saveRelated(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$saveLater = array();
|
||||
foreach ($record->_getReferences() as $k => $v) {
|
||||
@ -499,7 +499,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
$obj = $record->get($rel->getAlias());
|
||||
|
||||
// Protection against infinite function recursion before attempting to save
|
||||
if ($obj instanceof Doctrine_Entity && $obj->isModified()) {
|
||||
if ($obj instanceof Doctrine_ORM_Entity && $obj->isModified()) {
|
||||
$obj->save();
|
||||
|
||||
/** Can this be removed?
|
||||
@ -531,7 +531,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine_Entity $record
|
||||
* @return void
|
||||
*/
|
||||
public function saveAssociations(Doctrine_Entity $record)
|
||||
public function saveAssociations(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
foreach ($record->_getReferences() as $relationName => $relatedObject) {
|
||||
if ($relatedObject === Doctrine_Null::$INSTANCE) {
|
||||
@ -573,7 +573,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @return boolean whether or not the update was successful
|
||||
* @todo Move to Doctrine_Table (which will become Doctrine_Mapper).
|
||||
*/
|
||||
protected function _update(Doctrine_Entity $record)
|
||||
protected function _update(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$record->preUpdate();
|
||||
$this->notifyEntityListeners($record, 'preUpdate', Doctrine_Event::RECORD_UPDATE);
|
||||
@ -587,7 +587,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
return true;
|
||||
}
|
||||
|
||||
abstract protected function _doUpdate(Doctrine_Entity $entity);
|
||||
abstract protected function _doUpdate(Doctrine_ORM_Entity $entity);
|
||||
|
||||
/**
|
||||
* Inserts an entity.
|
||||
@ -595,7 +595,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @param Doctrine_Entity $record record to be inserted
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _insert(Doctrine_Entity $record)
|
||||
protected function _insert(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$record->preInsert();
|
||||
$this->notifyEntityListeners($record, 'preInsert', Doctrine_Event::RECORD_INSERT);
|
||||
@ -609,7 +609,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
return true;
|
||||
}
|
||||
|
||||
abstract protected function _doInsert(Doctrine_Entity $entity);
|
||||
abstract protected function _doInsert(Doctrine_ORM_Entity $entity);
|
||||
|
||||
/**
|
||||
* Deletes given entity and all it's related entities.
|
||||
@ -619,7 +619,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
* @return boolean true on success, false on failure
|
||||
* @throws Doctrine_Mapper_Exception
|
||||
*/
|
||||
public function delete_old(Doctrine_Entity $record)
|
||||
public function delete_old(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
if ( ! $record->exists()) {
|
||||
return false;
|
||||
@ -640,7 +640,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
|
||||
$table = $this->_classMetadata;
|
||||
|
||||
$state = $record->_state();
|
||||
$record->_state(Doctrine_Entity::STATE_LOCKED);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_LOCKED);
|
||||
|
||||
$this->_doDelete($record);
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
* @return boolean
|
||||
* @override
|
||||
*/
|
||||
public function insert(Doctrine_Entity $entity)
|
||||
public function insert(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$class = $entity->getClass();
|
||||
|
||||
@ -88,7 +88,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
* @param Doctrine_Entity $record record to be updated
|
||||
* @return boolean whether or not the update was successful
|
||||
*/
|
||||
protected function _doUpdate(Doctrine_Entity $record)
|
||||
protected function _doUpdate(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$conn = $this->_conn;
|
||||
$classMetadata = $this->_classMetadata;
|
||||
@ -99,7 +99,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
array_unshift($classes, $component);
|
||||
|
||||
foreach ($record as $field => $value) {
|
||||
if ($value instanceof Doctrine_Entity) {
|
||||
if ($value instanceof Doctrine_ORM_Entity) {
|
||||
if ( ! $value->exists()) {
|
||||
$value->save();
|
||||
}
|
||||
@ -122,7 +122,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
* Deletes an entity that is part of a Class Table Inheritance hierarchy.
|
||||
*
|
||||
*/
|
||||
protected function _doDelete(Doctrine_Entity $record)
|
||||
protected function _doDelete(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$conn = $this->_conn;
|
||||
try {
|
||||
@ -130,7 +130,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
$conn->beginInternalTransaction();
|
||||
$this->_deleteComposites($record);
|
||||
|
||||
$record->_state(Doctrine_Entity::STATE_TDIRTY);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_TDIRTY);
|
||||
|
||||
$identifier = $this->_convertFieldToColumnNames($record->identifier(), $class);
|
||||
|
||||
@ -141,7 +141,7 @@ class Doctrine_ORM_Persisters_JoinedSubclassPersister extends Doctrine_ORM_Persi
|
||||
$this->_deleteRow($parentClass->getTableName(), $identifier);
|
||||
}
|
||||
|
||||
$record->_state(Doctrine_Entity::STATE_TCLEAN);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_TCLEAN);
|
||||
|
||||
$this->removeRecord($record); // @todo should be done in the unitofwork
|
||||
$conn->commit();
|
||||
|
@ -34,7 +34,7 @@ class Doctrine_ORM_Persisters_StandardEntityPersister extends Doctrine_ORM_Persi
|
||||
/**
|
||||
* Deletes an entity.
|
||||
*/
|
||||
protected function _doDelete(Doctrine_Entity $record)
|
||||
protected function _doDelete(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$conn = $this->_conn;
|
||||
$metadata = $this->_classMetadata;
|
||||
@ -42,11 +42,11 @@ class Doctrine_ORM_Persisters_StandardEntityPersister extends Doctrine_ORM_Persi
|
||||
$conn->beginInternalTransaction();
|
||||
$this->_deleteComposites($record);
|
||||
|
||||
$record->_state(Doctrine_Entity::STATE_TDIRTY);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_TDIRTY);
|
||||
|
||||
$identifier = $this->_convertFieldToColumnNames($record->identifier(), $metadata);
|
||||
$this->_deleteRow($metadata->getTableName(), $identifier);
|
||||
$record->_state(Doctrine_Entity::STATE_TCLEAN);
|
||||
$record->_state(Doctrine_ORM_Entity::STATE_TCLEAN);
|
||||
|
||||
$this->removeRecord($record);
|
||||
$conn->commit();
|
||||
@ -61,7 +61,7 @@ class Doctrine_ORM_Persisters_StandardEntityPersister extends Doctrine_ORM_Persi
|
||||
*
|
||||
* @param Doctrine_Entity $record The entity to insert.
|
||||
*/
|
||||
protected function _doInsert(Doctrine_Entity $record)
|
||||
protected function _doInsert(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$conn = $this->_conn;
|
||||
|
||||
@ -105,7 +105,7 @@ class Doctrine_ORM_Persisters_StandardEntityPersister extends Doctrine_ORM_Persi
|
||||
/**
|
||||
* Updates an entity.
|
||||
*/
|
||||
protected function _doUpdate(Doctrine_Entity $record)
|
||||
protected function _doUpdate(Doctrine_ORM_Entity $record)
|
||||
{
|
||||
$conn = $this->_conn;
|
||||
$classMetadata = $this->_classMetadata;
|
||||
|
@ -66,7 +66,7 @@ class Doctrine_Query_Parser_AbstractSchemaName extends Doctrine_Query_ParserRule
|
||||
{
|
||||
if (class_exists($componentName)) {
|
||||
$reflectionClass = new ReflectionClass($componentName);
|
||||
$dctrnEntityReflectionClass = new ReflectionClass('Doctrine_Entity');
|
||||
$dctrnEntityReflectionClass = new ReflectionClass('Doctrine_ORM_Entity');
|
||||
|
||||
return $reflectionClass->isSubclassOf($dctrnEntityReflectionClass);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class Orm_Entity_AccessorTest extends Doctrine_OrmTestCase
|
||||
|
||||
/* Local test classes */
|
||||
|
||||
class CustomAccessorMutatorTestEntity extends Doctrine_Entity
|
||||
class CustomAccessorMutatorTestEntity extends Doctrine_ORM_Entity
|
||||
{
|
||||
public static function initMetadata($mapping)
|
||||
{
|
||||
@ -48,7 +48,7 @@ class CustomAccessorMutatorTestEntity extends Doctrine_Entity
|
||||
}
|
||||
}
|
||||
|
||||
class MagicAccessorMutatorTestEntity extends Doctrine_Entity
|
||||
class MagicAccessorMutatorTestEntity extends Doctrine_ORM_Entity
|
||||
{
|
||||
public static function initMetadata($mapping)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ class Orm_Entity_ConstructorTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
}
|
||||
|
||||
class ConstructorTestEntity1 extends Doctrine_Entity
|
||||
class ConstructorTestEntity1 extends Doctrine_ORM_Entity
|
||||
{
|
||||
public function __construct($username = null)
|
||||
{
|
||||
|
@ -86,8 +86,8 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1] instanceof Doctrine_ORM_Entity);
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_ARRAY) {
|
||||
$this->assertTrue(is_array($result));
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
@ -186,11 +186,11 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
$this->assertTrue(is_array($result));
|
||||
@ -273,8 +273,8 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity);
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
$this->assertEquals(2, count($result));
|
||||
|
||||
@ -377,8 +377,8 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result[0]['1'] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1]['2'] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0]['1'] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1]['2'] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0]['1']['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertEquals(2, count($result[0]['1']['phonenumbers']));
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
@ -521,18 +521,18 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['articles'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][1] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][1] instanceof Doctrine_ORM_Entity);
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
//...
|
||||
$this->assertEquals(6, count($result));
|
||||
@ -705,23 +705,23 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
}
|
||||
|
||||
if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity);
|
||||
// phonenumbers
|
||||
$this->assertTrue($result[0][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['phonenumbers'][1] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['phonenumbers'][0] instanceof Doctrine_ORM_Entity);
|
||||
// articles
|
||||
$this->assertTrue($result[0][0]['articles'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['articles'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][1] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1][0]['articles'][1] instanceof Doctrine_ORM_Entity);
|
||||
// article comments
|
||||
$this->assertTrue($result[0][0]['articles'][0]['comments'] instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0][0]['articles'][0]['comments'][0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0][0]['articles'][0]['comments'][0] instanceof Doctrine_ORM_Entity);
|
||||
// empty comment collections
|
||||
$this->assertTrue($result[0][0]['articles'][1]['comments'] instanceof Doctrine_Collection);
|
||||
$this->assertEquals(0, count($result[0][0]['articles'][1]['comments']));
|
||||
@ -849,8 +849,8 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
|
||||
$this->assertTrue(is_array($result[1]));
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_RECORD) {
|
||||
$this->assertTrue($result instanceof Doctrine_Collection);
|
||||
$this->assertTrue($result[0] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[1] instanceof Doctrine_Entity);
|
||||
$this->assertTrue($result[0] instanceof Doctrine_ORM_Entity);
|
||||
$this->assertTrue($result[1] instanceof Doctrine_ORM_Entity);
|
||||
} else if ($hydrationMode == Doctrine::HYDRATE_SCALAR) {
|
||||
//...
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase
|
||||
|
||||
public function testRegisterDirty()
|
||||
{
|
||||
$this->assertEquals(Doctrine_Entity::STATE_NEW, $this->_user->_state());
|
||||
$this->assertEquals(Doctrine_ORM_Entity::STATE_NEW, $this->_user->_state());
|
||||
$this->assertFalse($this->_unitOfWork->isInIdentityMap($this->_user));
|
||||
$this->_unitOfWork->registerDirty($this->_user);
|
||||
$this->assertTrue($this->_unitOfWork->isRegisteredDirty($this->_user));
|
||||
@ -105,7 +105,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase
|
||||
|
||||
public function testSavingSingleEntityWithIdentityColumnForcesInsert()
|
||||
{
|
||||
$this->assertEquals(Doctrine_Entity::STATE_NEW, $this->_user->_state());
|
||||
$this->assertEquals(Doctrine_ORM_Entity::STATE_NEW, $this->_user->_state());
|
||||
|
||||
$this->_unitOfWork->save($this->_user);
|
||||
|
||||
@ -114,7 +114,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase
|
||||
$this->assertEquals(0, count($this->_persisterMock->getDeletes()));
|
||||
|
||||
$this->assertTrue($this->_unitOfWork->isInIdentityMap($this->_user));
|
||||
$this->assertEquals(Doctrine_Entity::STATE_MANAGED, $this->_user->_state());
|
||||
$this->assertEquals(Doctrine_ORM_Entity::STATE_MANAGED, $this->_user->_state());
|
||||
|
||||
// should no longer be scheduled for insert
|
||||
$this->assertFalse($this->_unitOfWork->isRegisteredNew($this->_user));
|
||||
|
@ -8,7 +8,7 @@ class Doctrine_EntityPersisterMock extends Doctrine_ORM_Persisters_StandardEntit
|
||||
|
||||
private $_identityColumnValueCounter = 0;
|
||||
|
||||
public function insert(Doctrine_Entity $entity)
|
||||
public function insert(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
if ($entity->getClass()->isIdGeneratorIdentity()) {
|
||||
$entity->_assignIdentifier($this->_identityColumnValueCounter++);
|
||||
@ -18,12 +18,12 @@ class Doctrine_EntityPersisterMock extends Doctrine_ORM_Persisters_StandardEntit
|
||||
$this->_inserts[] = $entity;
|
||||
}
|
||||
|
||||
public function update(Doctrine_Entity $entity)
|
||||
public function update(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_updates[] = $entity;
|
||||
}
|
||||
|
||||
public function delete(Doctrine_Entity $entity)
|
||||
public function delete(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
$this->_deletes[] = $entity;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class Doctrine_SequenceMock extends Doctrine_ORM_Id_SequenceGenerator
|
||||
* @param Doctrine_Entity $entity
|
||||
* @override
|
||||
*/
|
||||
public function generate(Doctrine_Entity $entity)
|
||||
public function generate(Doctrine_ORM_Entity $entity)
|
||||
{
|
||||
return $this->_sequenceNumber++;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#use Doctrine::ORM::Entity;
|
||||
|
||||
class CmsArticle extends Doctrine_Entity
|
||||
class CmsArticle extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $topic;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#use Doctrine::ORM::Entity;
|
||||
|
||||
class CmsComment extends Doctrine_Entity
|
||||
class CmsComment extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $topic;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class CmsPhonenumber extends Doctrine_Entity
|
||||
class CmsPhonenumber extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $user_id;
|
||||
#protected $phonenumber;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#use Doctrine::ORM::Entity;
|
||||
|
||||
class CmsUser extends Doctrine_Entity
|
||||
class CmsUser extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $status;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class CompanyEmployee extends Doctrine_Entity
|
||||
class CompanyEmployee extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $salary;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class ForumAvatar extends Doctrine_Entity
|
||||
class ForumAvatar extends Doctrine_ORM_Entity
|
||||
{
|
||||
|
||||
public static function initMetadata($mapping)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class ForumBoard extends Doctrine_Entity
|
||||
class ForumBoard extends Doctrine_ORM_Entity
|
||||
{
|
||||
public static function initMetadata($mapping)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class ForumCategory extends Doctrine_Entity
|
||||
class ForumCategory extends Doctrine_ORM_Entity
|
||||
{
|
||||
|
||||
public static function initMetadata($mapping)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#use Doctrine::ORM::Entity;
|
||||
|
||||
class ForumEntry extends Doctrine_Entity
|
||||
class ForumEntry extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $topic;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#use Doctrine::ORM::Entity;
|
||||
|
||||
class ForumUser extends Doctrine_Entity
|
||||
class ForumUser extends Doctrine_ORM_Entity
|
||||
{
|
||||
#protected $id;
|
||||
#protected $username;
|
||||
|
Loading…
x
Reference in New Issue
Block a user