|
@@ -43,7 +43,7 @@ abstract class RESTController extends VoryxController
|
|
* @QueryParam(name="limit", requirements="\d+", default="20", description="How many notes to return.")
|
|
* @QueryParam(name="limit", requirements="\d+", default="20", description="How many notes to return.")
|
|
* @QueryParam(name="order_by", nullable=true, array=true, description="Order by fields. Must be an array ie. &order_by[name]=ASC&order_by[description]=DESC")
|
|
* @QueryParam(name="order_by", nullable=true, array=true, description="Order by fields. Must be an array ie. &order_by[name]=ASC&order_by[description]=DESC")
|
|
* @QueryParam(name="filters", nullable=true, array=true, description="Filter by fields. Must be an array ie. &filters[id]=3")
|
|
* @QueryParam(name="filters", nullable=true, array=true, description="Filter by fields. Must be an array ie. &filters[id]=3")
|
|
- * &filters[qb-criteria] => Utilizará el matching con criteria donde los parámetros filters realizarán "field like %value%".
|
|
|
|
|
|
+ * &filters[qb-criteria] => Utilizará el matching con criteria donde los parámetros filters realizarán "field like %value%".
|
|
* &filters[qb-ids] => Require qb-criteria. This option filter by ids separated by ','. ie. &filters[qb-ids]=1,2,8,9.
|
|
* &filters[qb-ids] => Require qb-criteria. This option filter by ids separated by ','. ie. &filters[qb-ids]=1,2,8,9.
|
|
*/
|
|
*/
|
|
public function cgetAction(ParamFetcherInterface $paramFetcher)
|
|
public function cgetAction(ParamFetcherInterface $paramFetcher)
|
|
@@ -81,10 +81,18 @@ abstract class RESTController extends VoryxController
|
|
} else {
|
|
} else {
|
|
foreach ($filters as $field => $value) {
|
|
foreach ($filters as $field => $value) {
|
|
if ($orWhere) {
|
|
if ($orWhere) {
|
|
- $criteria->orWhere($criteria->expr()->contains("$field", "$value"));
|
|
|
|
|
|
+ if (is_numeric($value)) {
|
|
|
|
+ $criteria->orWhere($criteria->expr()->in("$field", (is_array($value) ? $value : [$value])));
|
|
|
|
+ } else {
|
|
|
|
+ $criteria->orWhere($criteria->expr()->contains("$field", "$value"));
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- $criteria->andWhere($criteria->expr()->contains("$field", "$value"));
|
|
|
|
- }
|
|
|
|
|
|
+ if (is_numeric($value)) {
|
|
|
|
+ $criteria->andWhere($criteria->expr()->in("$field", (is_array($value) ? $value : [$value])));
|
|
|
|
+ } else {
|
|
|
|
+ $criteria->andWhere($criteria->expr()->contains("$field", "$value"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (!is_null($paramFetcher->get('limit'))) {
|
|
if (!is_null($paramFetcher->get('limit'))) {
|