public function registerEntity(&$entity)
    {
        $this->unstashEntity($entity);

        $className    = $this->getClassName($entity);
        $objectHashId = $this->getObjectHashId($entity);
        $entityId     = $this->getEntityId($entity);

        if (!isset($this->entities[$className])) {
            $this->entities[$className] = [];
        }

        if (isset($this->entities[$className][$entityId])) {
            // Change the reference of the input entity to the one that's already registered
            $entity = $this->entities[$className][$entityId];
        } else {
            // Register this entity
            $this->changeTracker->startTracking($entity);
            $this->entities[$className][$entityId] = $entity;
            $this->entityStates[$objectHashId]     = EntityStates::REGISTERED;
        }
    }
public function registerEntity(&$entity)
    {
        $this->unstashEntity($entity);

        $className    = $this->getClassName($entity);
        $objectHashId = $this->getObjectHashId($entity);
        $entityId     = $this->getEntityId($entity);

        if (!isset($this->entities[$className])) {
            $this->entities[$className] = [];
        }

        if (isset($this->entities[$className][$entityId])) {
            // Change the reference of the input entity to the one that's already registered
            $entity = $this->entities[$className][$entityId];
        } else {
            // Register this entity
            $this->changeTracker->startTracking($entity);
            $this->entities[$className][$entityId] = $entity;
            $this->entityStates[$objectHashId]     = EntityStates::REGISTERED;
        }
    }
public function registerEntity ( & $ entity ) { $ this -> unstashEntity ( $ entity ) ; $ className = $ this -> getClassName ( $ entity ) ; $ objectHashId = $ this -> getObjectHashId ( $ entity ) ; $ entityId = $ this -> getEntityId ( $ entity ) ; if ( ! isset ( $ this -> entities [ $ className ] ) ) { $ this -> entities [ $ className ] = [ ] ; } if ( isset ( $ this -> entities [ $ className ] [ $ entityId ] ) ) { // Change the reference of the input entity to the one that's already registered $ entity = $ this -> entities [ $ className ] [ $ entityId ] ; } else { // Register this entity $ this -> changeTracker -> startTracking ( $ entity ) ; $ this -> entities [ $ className ] [ $ entityId ] = $ entity ; $ this -> entityStates [ $ objectHashId ] = EntityStates :: REGISTERED ; } }
Registers an entity

@param   object $entity The entity to register

@return  void
@throws  OrmException  if there was an error registering the entity
Registers an entity