Example #1
0
File: Sort.php Project: cosmow/riak
 /**
  * @param Builder $builder
  * @param array|string $fieldName Field name or array of field/order pairs
  * @param int|string $order       Field order (if one field is specified)
  */
 public function __construct(Builder $builder, $fieldName, $order = null)
 {
     parent::__construct($builder);
     $allowedMetaSort = array('textScore');
     $fields = is_array($fieldName) ? $fieldName : array($fieldName => $order);
     foreach ($fields as $fieldName => $order) {
         if (is_string($order)) {
             if (in_array($order, $allowedMetaSort)) {
                 $order = array('$meta' => $order);
             } else {
                 $order = strtolower($order) === 'asc' ? 1 : -1;
             }
         }
         $this->sort[$fieldName] = $order;
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(Builder $builder)
 {
     $this->expr = new Expr();
     parent::__construct($builder);
 }
Example #3
0
File: Skip.php Project: cosmow/riak
 /**
  * @param Builder $builder
  * @param integer $skip
  */
 public function __construct(Builder $builder, $skip)
 {
     parent::__construct($builder);
     $this->skip = (int) $skip;
 }
Example #4
0
 /**
  * @param Builder $builder
  * @param string $fieldName
  */
 public function __construct(Builder $builder, $fieldName)
 {
     parent::__construct($builder);
     $this->fieldName = (string) $fieldName;
 }
Example #5
0
 /**
  * @param Builder $builder
  * @param integer $limit
  */
 public function __construct(Builder $builder, $limit)
 {
     parent::__construct($builder);
     $this->limit = (int) $limit;
 }
Example #6
0
File: Out.php Project: cosmow/riak
 /**
  * @param Builder $builder
  * @param string $collection
  */
 public function __construct(Builder $builder, $collection)
 {
     parent::__construct($builder);
     $this->collection = $collection;
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public function __construct(Builder $builder)
 {
     parent::__construct($builder);
     $this->query = new Expr();
 }