예제 #1
0
 /**
  * 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
  * 
  * @return void
  */
 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;
         }
     }
 }
예제 #2
0
파일: chain.php 프로젝트: stonyyi/anahita
 /**
  * Get the priority of a command
  * 
  * @param  KCommandInterface $object
  * @return integer The command priority
  * @throws InvalidArgumentException if the object doesn't implement KCommandInterface
  */
 public function getPriority(KObjectHandlable $command)
 {
     if (!$command instanceof KCommandInterface) {
         throw new InvalidArgumentException('Command needs to implement KCommandInterface');
     }
     return parent::getPriority($command);
 }
예제 #3
0
 /**
  * Get the priority of a command
  *
  * @param object    A KCommand object
  * @param integer   The command priority
  * @return integer The command priority
  */
 public function getPriority(KCommandInterface $cmd)
 {
     return parent::getPriority($cmd);
 }
예제 #4
0
 /**
  * Get the priority of a command
  *
  * @param   KCommandHandlerInterface $handler A command handler
  * @return integer The command priority
  */
 public function getHandlerPriority(KCommandHandlerInterface $handler)
 {
     return $this->__queue->getPriority($handler);
 }