public function insertEntity($entity, $identifiers = array())
    {
        //check if an entity has already been added
        //if not then add it to the bottom
        if (!$this->_entities->getPriority($entity)) {
            $priority = count($this->_entities);
            $this->_entities->enqueue($entity, $priority);
        }

        //get all the entity parent classes
        $classes = $entity->getEntityDescription()->getUniqueIdentifiers();
        $description = $entity->getEntityDescription();

        foreach ($identifiers as $key => $value) {
            if (empty($value)) {
                continue;
            }

            $property = $description->getProperty($key);
            $value = $property->serialize($value);
            $value = implode('', $value);

            //use the identifier application as the unique context
            $key = $entity->getIdentifier()->application.$key.$value;

            foreach ($classes as $class) {
                if (!isset($this->_identity_map[$class])) {
                    $this->_identity_map[$class] = array();
                }

                $this->_identity_map[$class][$key] = $entity;
            }
        }
    }
public function insertEntity($entity, $identifiers = array())
    {
        //check if an entity has already been added
        //if not then add it to the bottom
        if (!$this->_entities->getPriority($entity)) {
            $priority = count($this->_entities);
            $this->_entities->enqueue($entity, $priority);
        }

        //get all the entity parent classes
        $classes = $entity->getEntityDescription()->getUniqueIdentifiers();
        $description = $entity->getEntityDescription();

        foreach ($identifiers as $key => $value) {
            if (empty($value)) {
                continue;
            }

            $property = $description->getProperty($key);
            $value = $property->serialize($value);
            $value = implode('', $value);

            //use the identifier application as the unique context
            $key = $entity->getIdentifier()->application.$key.$value;

            foreach ($classes as $class) {
                if (!isset($this->_identity_map[$class])) {
                    $this->_identity_map[$class] = array();
                }

                $this->_identity_map[$class][$key] = $entity;
            }
        }
    }
public function insertEntity ( $ entity , $ identifiers = array ( ) ) { //check if an entity has already been added //if not then add it to the bottom if ( ! $ this -> _entities -> getPriority ( $ entity ) ) { $ priority = count ( $ this -> _entities ) ; $ this -> _entities -> enqueue ( $ entity , $ priority ) ; } //get all the entity parent classes $ classes = $ entity -> getEntityDescription ( ) -> getUniqueIdentifiers ( ) ; $ description = $ entity -> getEntityDescription ( ) ; foreach ( $ identifiers as $ key => $ value ) { if ( empty ( $ value ) ) { continue ; } $ property = $ description -> getProperty ( $ key ) ; $ value = $ property -> serialize ( $ value ) ; $ value = implode ( '' , $ value ) ; //use the identifier application as the unique context $ key = $ entity -> getIdentifier ( ) -> application . $ key . $ value ; foreach ( $ classes as $ class ) { if ( ! isset ( $ this -> _identity_map [ $ class ] ) ) { $ this -> _identity_map [ $ class ] = array ( ) ; } $ this -> _identity_map [ $ class ] [ $ key ] = $ entity ; } } }
Inserts an entity into the identity map. It uses the keys to uniquely identifies an entity.

@param AnDomainEntityAbstract $entity      The entity to insert
@param array                  $identifiers An array of identifiying keys that uniquely identifies an entity
Inserts an entity into the identity map . It uses the keys to uniquely identifies an entity .