public function findResources ($resourceName) {
        $request = get_request();
        $resource = Resources::get($resourceName);
        if ($request->has("rawQuery")) {
            $query = unserialize($request->get("rawQuery"));
            $resource->limit($query->getLimit());
            $resource->offset($query->getOffset());
            $resource->distinct($query->getDistinct());
            $resource->selectFields($query->getSelectFields());
            $resource->orderByFields($query->getOrderByFields());
            $resource->groupByFields($query->getGroupByFields());
            $resource->whereConditionGroup($query->getwhereConditionGroup());
            $resource->havingConditionGroup($query->getHavingConditionGroup());
            $resource->joins($query->getJoins());
        }
        else {
            $resource->limit(100);
            $parameters = $request->params();
            foreach ($parameters as $key=>$value) {
                switch ($key) {
                    case "limit":
                        $resource->limit($value);
                        break;
                    case "offset":
                        $resource->offset($value);
                        break;
                    case "distinct":
                        $resource->distinct($value);
                        break;
                    case "select":
                        $resource->selectFields(explode(",", $value));
                        break;
                    case "orderBy":
                        $resource->orderByFields(explode(",", $value));
                        break;
                    case "groupBy":
                        $resource->groupByFields(explode(",", $value));
                        break;
                    case "where":
                        $resource->whereConditionGroup($this->createConditionGroup($value));
                        break;
                    case "having":
                        $resource->havingConditionGroup($this->createConditionGroup($value));
                        break;
                    case "filters":
                        $filters = $value;
                        foreach ($filters as $filter) {
                            if (!empty($filter["operator"])) {
                                $resource->where($filter["property"], $filter["operator"], $filter["property"]);
                            } else {
                                $resource->where($filter["property"], $filter["value"]);
                            }
                        }
                        break;
                    default:
                        $resource->where($key, $value);
                        break;
                }
            }
        }
        return $resource->find();
    }
public function findResources ($resourceName) {
        $request = get_request();
        $resource = Resources::get($resourceName);
        if ($request->has("rawQuery")) {
            $query = unserialize($request->get("rawQuery"));
            $resource->limit($query->getLimit());
            $resource->offset($query->getOffset());
            $resource->distinct($query->getDistinct());
            $resource->selectFields($query->getSelectFields());
            $resource->orderByFields($query->getOrderByFields());
            $resource->groupByFields($query->getGroupByFields());
            $resource->whereConditionGroup($query->getwhereConditionGroup());
            $resource->havingConditionGroup($query->getHavingConditionGroup());
            $resource->joins($query->getJoins());
        }
        else {
            $resource->limit(100);
            $parameters = $request->params();
            foreach ($parameters as $key=>$value) {
                switch ($key) {
                    case "limit":
                        $resource->limit($value);
                        break;
                    case "offset":
                        $resource->offset($value);
                        break;
                    case "distinct":
                        $resource->distinct($value);
                        break;
                    case "select":
                        $resource->selectFields(explode(",", $value));
                        break;
                    case "orderBy":
                        $resource->orderByFields(explode(",", $value));
                        break;
                    case "groupBy":
                        $resource->groupByFields(explode(",", $value));
                        break;
                    case "where":
                        $resource->whereConditionGroup($this->createConditionGroup($value));
                        break;
                    case "having":
                        $resource->havingConditionGroup($this->createConditionGroup($value));
                        break;
                    case "filters":
                        $filters = $value;
                        foreach ($filters as $filter) {
                            if (!empty($filter["operator"])) {
                                $resource->where($filter["property"], $filter["operator"], $filter["property"]);
                            } else {
                                $resource->where($filter["property"], $filter["value"]);
                            }
                        }
                        break;
                    default:
                        $resource->where($key, $value);
                        break;
                }
            }
        }
        return $resource->find();
    }
public function findResources ( $ resourceName ) { $ request = get_request ( ) ; $ resource = Resources :: get ( $ resourceName ) ; if ( $ request -> has ( "rawQuery" ) ) { $ query = unserialize ( $ request -> get ( "rawQuery" ) ) ; $ resource -> limit ( $ query -> getLimit ( ) ) ; $ resource -> offset ( $ query -> getOffset ( ) ) ; $ resource -> distinct ( $ query -> getDistinct ( ) ) ; $ resource -> selectFields ( $ query -> getSelectFields ( ) ) ; $ resource -> orderByFields ( $ query -> getOrderByFields ( ) ) ; $ resource -> groupByFields ( $ query -> getGroupByFields ( ) ) ; $ resource -> whereConditionGroup ( $ query -> getwhereConditionGroup ( ) ) ; $ resource -> havingConditionGroup ( $ query -> getHavingConditionGroup ( ) ) ; $ resource -> joins ( $ query -> getJoins ( ) ) ; } else { $ resource -> limit ( 100 ) ; $ parameters = $ request -> params ( ) ; foreach ( $ parameters as $ key => $ value ) { switch ( $ key ) { case "limit" : $ resource -> limit ( $ value ) ; break ; case "offset" : $ resource -> offset ( $ value ) ; break ; case "distinct" : $ resource -> distinct ( $ value ) ; break ; case "select" : $ resource -> selectFields ( explode ( "," , $ value ) ) ; break ; case "orderBy" : $ resource -> orderByFields ( explode ( "," , $ value ) ) ; break ; case "groupBy" : $ resource -> groupByFields ( explode ( "," , $ value ) ) ; break ; case "where" : $ resource -> whereConditionGroup ( $ this -> createConditionGroup ( $ value ) ) ; break ; case "having" : $ resource -> havingConditionGroup ( $ this -> createConditionGroup ( $ value ) ) ; break ; case "filters" : $ filters = $ value ; foreach ( $ filters as $ filter ) { if ( ! empty ( $ filter [ "operator" ] ) ) { $ resource -> where ( $ filter [ "property" ] , $ filter [ "operator" ] , $ filter [ "property" ] ) ; } else { $ resource -> where ( $ filter [ "property" ] , $ filter [ "value" ] ) ; } } break ; default : $ resource -> where ( $ key , $ value ) ; break ; } } } return $ resource -> find ( ) ; }
Busca recursos en el sistema
@param $resourceName
@return mixed
Busca recursos en el sistema