예제 #1
0
 /**
  * Convert a Jasny DB styled filter to a MongoDB query.
  * 
  * @param array $filter
  * @param array $opts
  * @return array
  */
 protected static function filterToQuery($filter, array $opts = [])
 {
     $filter = static::castForDB($filter);
     $filter = static::mapToFields($filter);
     if (in_array('from-trash', $opts)) {
         $filter['_deleted'] = true;
     } elseif (!in_array('include-trash', $opts)) {
         $filter['_deleted'] = null;
     }
     return DB::filterToQuery($filter);
 }
예제 #2
0
 /**
  * Convert a Jasny DB styled filter to a MongoDB query.
  * 
  * @param array $filter
  * @param array $opts
  * @return array
  */
 protected static function filterToQuery($filter, array $opts = [])
 {
     $filter = static::castForDB($filter);
     $filter = static::mapToFields($filter);
     $opts += ['deleted' => false];
     // Defaults to no deleted
     if ($opts['deleted'] === 'only' || in_array('from-trash', $opts, true)) {
         $filter['_deleted'] = true;
     } elseif ($opts['deleted'] !== 'included' && !in_array('include-trash', $opts, true)) {
         $filter['_deleted'] = null;
     }
     return DB::filterToQuery($filter);
 }
예제 #3
0
 /**
  * Convert a Jasny DB styled filter to a MongoDB query.
  * 
  * @param array $filter
  * @param array $opts
  * @return array
  */
 protected static function filterToQuery($filter, array $opts = [])
 {
     $castedFilter = static::castForDB($filter, $opts);
     $mappedFilter = static::mapToFields($castedFilter);
     return DB::filterToQuery($mappedFilter);
 }