find() public method

public find ( $documentName = null )
 /**
  * Get products as array according to the query, the limit and the skip. The column "is_associated"
  * is also added.
  *
  * @param Builder $queryBuilder the query builder
  * @param array   $rawQuery     the ids of the products that are associated
  * @param int     $limit        the query parameters
  * @param int     $skip         the limit of products to select for the page
  * @param bool    $isAssociated value of the "is associated" column that will be added
  *
  * @throws \Doctrine\ODM\MongoDB\MongoDBException
  * @return array
  */
 protected function getProductsAsArray(Builder $queryBuilder, array $rawQuery, $limit, $skip, $isAssociated)
 {
     $queryBuilder->find();
     $queryBuilder->setQueryArray($rawQuery);
     $queryBuilder->limit($limit);
     $queryBuilder->skip($skip);
     $query = $queryBuilder->getQuery();
     $results = $query->execute()->toArray();
     foreach ($results as &$product) {
         $product['is_associated'] = $isAssociated;
     }
     return $results;
 }
Example #2
0
 /**
  * Change the query type to find and optionally set and change the class being queried.
  * Optionally sets the document name for the query
  *
  * @param string $documentName
  * @return QueryProxy this instance
  */
 public function find($documentName = null)
 {
     $this->queryChanged = true;
     return parent::find($s);
 }