Exemple #1
0
 /**
  * Set the save order 
  * 
  * @param AnDomainEntityAbstract $entity1 Lower priorty index (Higher) domain entity
  * @param AnDomainEntityAbstract $entity2 Higher priorty index (Lower) domain entity
  * 
  * @return void
  */
 public function setSaveOrder($entity1, $entity2)
 {
     //lower priorty index means it's saved first (higher priorty)
     //so if $entity1 has lower priorty index (higher priority) than $entity2
     //then $entity1 is saved before $entity2
     //higher prioriry index means lower priority
     $lower_priority = max($this->_entities->getPriority($entity1), $this->_entities->getPriority($entity2));
     //lower priority index means higher priority
     $higher_priority = min($this->_entities->getPriority($entity1), $this->_entities->getPriority($entity2));
     $this->_entities->setPriority($entity1, $higher_priority);
     $this->_entities->setPriority($entity2, $lower_priority);
 }
Exemple #2
0
 /**
  * Set the priority of a command
  * 
  * @param KCommandInterface $command
  * @param integer           $priority
  * @return \KCommandChain
  * @throws InvalidArgumentException if the object doesn't implement KCommandInterface
  */
 public function setPriority(KObjectHandlable $command, $priority)
 {
     if (!$command instanceof KCommandInterface) {
         throw new InvalidArgumentException('Command needs to implement KCommandInterface');
     }
     return parent::setPriority($cmd, $priority);
 }
Exemple #3
0
 /**
  * Set the priority of a command
  *
  * @param object    A KCommand object
  * @param integer   The command priority
  * @return KCommandChain
  */
 public function setPriority(KCommandInterface $cmd, $priority)
 {
     return parent::setPriority($cmd, $priority);
 }
 /**
  * Set the priority of a command
  *
  * @param  KCommandHandlerInterface $handler   A command handler
  * @param integer                   $priority  The command priority
  * @return KCommandChain
  */
 public function setHandlerPriority(KCommandHandlerInterface $handler, $priority)
 {
     $this->__queue->setPriority($handler, $priority);
     return $this;
 }