コード例 #1
0
ファイル: InMemoryLocator.php プロジェクト: cubiche/cubiche
 /**
  * {@inheritdoc}
  */
 public function locate($nameOfMessage)
 {
     if (!$this->handlers->containsKey($nameOfMessage)) {
         throw NotFoundException::handlerFor($nameOfMessage);
     }
     return $this->handlers->get($nameOfMessage);
 }
コード例 #2
0
 /**
  * @return Version
  */
 public function loadApplicationVersion()
 {
     if (!$this->store->containsKey(self::APPLICATION_VERSION_KEY)) {
         return Version::fromString('0.0.0');
     }
     return $this->store->get(self::APPLICATION_VERSION_KEY);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function remove($aggregateType, IdInterface $aggregateId, Version $aggregateVersion, Version $applicationVersion)
 {
     $applicationKey = $this->getApplicationKey($applicationVersion);
     if (!$this->store->containsKey($applicationKey)) {
         return;
     }
     /** @var ArrayHashMap $applicationCollection */
     $applicationCollection = $this->store->get($applicationKey);
     $aggregateKey = $this->getAggregateKey($aggregateType, $aggregateVersion);
     if (!$applicationCollection->containsKey($aggregateKey)) {
         return;
     }
     /** @var ArrayHashMap $aggregateCollection */
     $aggregateCollection = $applicationCollection->get($aggregateKey);
     $aggregateCollection->removeAt($aggregateId->toNative());
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function sort(ComparatorInterface $criteria = null)
 {
     if ($criteria !== null) {
         $this->criteria = $criteria;
     }
     parent::sort($this->criteria);
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function removeAll($streamName, Version $aggregateVersion, Version $applicationVersion)
 {
     $applicationKey = $this->getApplicationKey($applicationVersion);
     if (!$this->store->containsKey($applicationKey)) {
         throw new \RuntimeException(sprintf('The application %s not found in the event store.', $applicationKey));
     }
     /** @var ArrayHashMap $applicationCollection */
     $applicationCollection = $this->store->get($applicationKey);
     $streamKey = $this->getStreamKey($streamName, $aggregateVersion);
     $applicationCollection->removeAt($streamKey);
 }
コード例 #6
0
ファイル: EventDispatcher.php プロジェクト: cubiche/cubiche
 /**
  * {@inheritdoc}
  */
 public function removeListener($eventName, callable $listener)
 {
     if (!$this->listeners->containsKey($eventName)) {
         return;
     }
     /** @var SortedArrayHashMap $sortedListeners */
     $sortedListeners = $this->listeners->get($eventName);
     /** @var ArrayList $listeners */
     foreach ($sortedListeners as $priority => $listeners) {
         foreach ($listeners as $registered) {
             /** @var DelegateListener $registered */
             if ($registered->equals($listener)) {
                 $listeners->remove($registered);
             }
         }
         if ($listeners->count() == 0) {
             $sortedListeners->removeAt($priority);
         }
     }
     if ($sortedListeners->count() == 0) {
         $this->listeners->removeAt($eventName);
     }
 }
コード例 #7
0
 /**
  * @param QueryBuilder $queryBuilder1
  * @param QueryBuilder $queryBuilder2
  *
  * @return bool
  */
 protected function hasSameOperator(QueryBuilder $queryBuilder1, QueryBuilder $queryBuilder2)
 {
     $intersection = new ArrayHashMap(\array_intersect_key($queryBuilder1->getQueryArray(), $queryBuilder2->getQueryArray()));
     return $intersection->keys()->findOne(Criteria::callback(function ($value) {
         return \strpos($value, '$') === 0;
     })) !== null;
 }
コード例 #8
0
ファイル: PropertyProjector.php プロジェクト: cubiche/cubiche
 /**
  * @return Property[]
  */
 public function properties()
 {
     return $this->properties->toArray();
 }