findBy() public method

Finds documents by a set of criteria.
public findBy ( array $criteria, array $sort = null, integer | null $limit = null, integer | null $skip = null ) : array
$criteria array Query criteria
$sort array Sort array for Cursor::sort()
$limit integer | null Limit for Cursor::limit()
$skip integer | null Skip for Cursor::skip()
return array
Beispiel #1
0
 /**
  * @param AggregateId $aggregateId
  * @return DomainEvent[]
  */
 public function find(AggregateId $aggregateId)
 {
     $events = [];
     /** @var $storedEvent StoredEvent */
     $storedEvents = $this->repository->findBy(['aggregateId' => (string) $aggregateId]);
     foreach ($storedEvents as $storedEvent) {
         $events[] = $storedEvent->getEvent();
     }
     return $events;
 }
 /**
  * @param $projectionName
  * @return Projection[]
  */
 public function find($projectionName)
 {
     $projections = [];
     /** @var $storedProjection StoredProjection */
     $storedProjections = $this->repository->findBy(['projectionName' => (string) $projectionName]);
     foreach ($storedProjections as $storedProjection) {
         $projections[] = $storedProjection->getProjection();
     }
     return $projections;
 }
 /**
  * {@inheritdoc}
  */
 public function findMappedStatements(array $criteria)
 {
     return parent::findBy($criteria);
 }
 /**
  * @return array
  */
 public function findActive()
 {
     return $this->repository->findBy(array('active' => true));
 }
Beispiel #5
0
 public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 {
     return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
 }
 public function findAllActivityBy(array $criteria = array())
 {
     return $this->repository->findBy($criteria);
 }
Beispiel #7
0
 /**
  * @param array         $criteria
  * @param array|null    $sort
  * @param null          $limit
  * @param null          $skip
  *
  * @return array
  */
 public function findBy(array $criteria, array $sort = null, $limit = null, $skip = null)
 {
     return parent::findBy(array_merge(['$or' => [['deleted' => ['$exists' => false]], ['deleted' => false]]], array_filter($criteria)), $sort, $limit, $skip);
 }
 /**
  * Finds Entities by a set of criteria.
  *
  * @param array    $criteria Query criteria
  * @param array    $sort     Sort array for Cursor::sort()
  * @param int|null $limit    Limit for Cursor::limit()
  * @param int|null $skip     Skip for Cursor::skip()
  *
  * @return AggregateRoot[]
  */
 protected function getBy(array $criteria, array $sort = null, $limit = null, $skip = null)
 {
     return $this->documentRepository->findBy($criteria, $sort, $limit, $skip);
 }