Get **or** criteria of current request.

@return array
434062
public function getOr()
    {
        $or = array();
        
        
        if($this->request->get('!or')){
            foreach ($this->request->get('!or') as $key => $value) {
                if(is_array($value)){
                    foreach($value as $k => $v){
                        $or[] = array($key => $v);
                    }
                }else{
                    $or[] = array($key => $value);    
                }
                
            }

            $or = array("!or" => $or);
        }

        return $or;
    }
312489
public function getSearchDefaults()
    {
        if (! isset($this->defaultSearchData[\MUtil_Model::REQUEST_ID2])) {
            if ($this->currentUser->hasPrivilege('pr.respondent.multiorg') &&
                    (! $this->currentOrganization->canHaveRespondents())) {
                $this->defaultSearchData[\MUtil_Model::REQUEST_ID2] = '';
            } else {
                $this->defaultSearchData[\MUtil_Model::REQUEST_ID2] = $this->currentOrganization->getId();
            }
        }

        $this->defaultSearchData['gr2t_id_track'] = 'show_all';

        return parent::getSearchDefaults();
    }
1278639
public function getClauses()
    {
        return array(
            $this->getSelect(),
            $this->getFrom(),
            $this->getJoins(),
            $this->getWhere(),
            $this->getGroup(),
            $this->getOrder(),
            $this->getLimit(),
        );
    }
834602
protected function getStrictRequestParameters()
    {
        $data = [];

        foreach ($this->strictUpdateKeys as $value)
            if (request()->has($value))
                $data[$value] = request($value);

        return $data;
    }
1369270
public static function get()
    {
        return [
            self::$equals,
            self::$lessThan,
            self::$lessThanEqualTo,
            self::$greaterThan,
            self::$greaterThanEqualTo,
            self::$doesNotEqual,
            self::$doesNotEqualAlt,
            self::$is,
            self::$isA,
            self::$isNot,
            self::$like,
        ];
    }
1310485
public function getRequestDataKeys()
    {
        if ($this->getType() !== self::TYPE_REQUEST) {
            return array();
        }

        if (array_key_exists('php://input', $this->mockedData)) {
            $data = $this->mockedData['php://input'];
        }
        else {
            $data = file_get_contents("php://input");
        }

        return array(
            \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY  => (bool) (strlen($data) > 0),
            \SwaggerValidator\Common\FactorySwagger::LOCATION_FORM  => $this->getRequestFormDataKey(),
            \SwaggerValidator\Common\FactorySwagger::LOCATION_QUERY => $this->getRequestQueryKey(),
        );
    }
223095
public function rules()
    {
        return [
            'description' => 'required|max:100',

            '_pictures_file' => [
                'mimes:jpeg,png,jpg',
                Rule::dimensions()->maxWidth(1000)->maxHeight(500)
            ],

            'name' => [
                'required',
                Rule::unique('categories')->ignore($this->request->get('current_category')),
            ],
        ];
    }
965665
public function rules()
    {
        $rules = [];

        if (($module = app('scaffold.module')) && $module instanceof Validable) {
            $rules = $module->rules();

            if (is_object($key = \Route::input('id')) && method_exists($key, 'getKey')) {
                $key = $key->getKey();
            }

            if (is_callable($rules)) {
                return $rules($key);
            }

            $rules = array_map(function ($rule) use ($key) {
                if (is_callable($rule)) {
                    $rule = $rule($key);
                }

                return $rule;
            }, $rules);
        }

        return $rules;
    }
405676
protected function getWhere()
    {
        $id = intval($this->request->getParam(\MUtil_Model::REQUEST_ID));
        $add = " = " . $id;

        return implode($add . ' OR ', (array) $this->filterOn) . $add;
    }
657928
protected function baseRequest()
    {
        return [
            'report_referer' => $this->server('HTTP_REFERER', ''),
            'report_user_agent' => $this->server('HTTP_USER_AGENT', ''),
            'report_host' => $this->server('HTTP_HOST', ''),
            'report_server_name' => $this->server('SERVER_NAME', ''),
            'report_remote_addr' => $this->server('REMOTE_ADDR', ''),
            'report_server_software' => $this->server('SERVER_SOFTWARE', ''),
            'report_uri' => $this->server('REQUEST_URI', ''),
            'report_time' => $this->server('REQUEST_TIME', ''),
            'report_method' => $this->server('REQUEST_METHOD', ''),
            'report_query' => $this->server('QUERY_STRING', ''),
            'app_base' => $this->server('DOCUMENT_ROOT', ''),
        ];
    }
372174
protected function getCriteriaConditions( array $params )
	{
		$expr = [];

		if( isset( $params['key'] ) )
		{
			foreach( (array) $params['key'] as $idx => $key )
			{
				if( $key != '' && isset( $params['op'][$idx] ) && $params['op'][$idx] != ''
					&& isset( $params['val'][$idx] ) && $params['val'][$idx] != ''
				) {
					$expr[] = [$params['op'][$idx] => [$key => $params['val'][$idx]]];
				}
			}

			if( !empty( $expr ) ) {
				$expr = ['&&' => $expr];
			}
		}

		return $expr;
	}
402850
public function orWhere($field)
    {
        if ($field instanceof Criteria) {
            return $this->root->inject(Node::OPERATOR_OR, $field->root)->getMostRecentCriteria();
        }

        return $this->root->append(Node::OPERATOR_OR, new Criteria($field, $this->root))->getMostRecentCriteria();
    }
280837
public function findAll()
    {
        // convert to criteria.
        $criteria = call_user_func_array(array($this, 'argsToCriteria'), func_get_args());
        
        // logical delete ?
        $schema = $this->getSchema();
        if ($schema->hasColumn('active')) {
            $criteria->where('active = ?', 1);
        }

        // to SQL.
        $sql = $criteria->toSQL();

        // query
        $sth = $this->query($sql, $criteria->getParams(), Database::TARGET_SLAVE);

        // to entities
        $entities = new Entities($this);
        $entities->setCriteria($criteria);
        foreach ($sth->fetchAll(Connection::FETCH_ASSOC) as $row) {
            $entities->add($this->build($row, true));
        }

        return $entities;
    }
1349903
protected function getPageRule()
    {
        $existsRule = Rule::exists($this->getTablePrefix().'pages', 'id')->using(function ($query) {
            if ($this->has('locale'))
                $query->where('locale', $this->get('locale', config('app.locale')));
        });

        return ['required', 'integer', $existsRule];
    }
447999
public function getAll()
    {
        if ($this->isRequestGet()) {
            try {
                $format   = $this->getRequestParameter('format');
                $search   = $this->hasRequestParameter('search') ? $this->getRawParameter('search') : '';
                $limit    = $this->hasRequestParameter('limit') ? $this->getRequestParameter('limit') : 30;
                $offset   = $this->hasRequestParameter('offset') ? $this->getRequestParameter('offset') : 0;
                $selectedUris = [];

                if(! empty($search) ){
                    $decodedSearch = json_decode($search, true);
                    if(is_array($decodedSearch) && count($decodedSearch) > 0){
                        $search = $decodedSearch;
                    }
                }
                if($this->hasRequestParameter('selectedUri')){
                    $selectedUri = $this->getRequestParameter('selectedUri');
                    if (!empty($selectedUri)) {
                        $selectedUris = [$selectedUri];
                    }
                }

                $class = $this->getClassParameter();
                if ($this->hasRequestParameter('classOnly')) {
                    $resources = $this->getResourceService()->getClasses($class, $format, $selectedUris, $search, $offset, $limit);
                } else {
                    $resources = $this->getResourceService()->getResources($class, $format, $selectedUris, $search, $offset, $limit);
                }

                $user = \common_Session_SessionManager::getSession()->getUser();
                if(isset($resources['nodes'])){
                    $permissions = $this->getResourceService()->getResourcesPermissions($user, $resources['nodes']);
                } else {
                    $permissions = $this->getResourceService()->getResourcesPermissions($user, $resources);
                }

                $this->returnSuccess([
                    'resources' => $resources,
                    'permissions' => $permissions
                ]);

            } catch (common_Exception $e) {
                $this->returnFailure($e);
            }
        }
    }
1239393
public function getPostedPostings()
    {
        $criteria = Criteria::create()
            ->where(Criteria::expr()->neq('postedAt', null))
            ->orderBy(array('postedAt' => Criteria::ASC))
        ;

        return $this->getPostings()->matching($criteria);
    }
533699
public static function criterias($params) {
        $orm = ORM::for_table($params['table']);

        foreach ($params['args'] as $arg) {
            $column = $arg[0];
            $operation = $arg[1];
            $value = $arg[2];
            
            switch($operation) {
                case '=':
                    $orm->where_equal($column, $value);
                    break;
                case '!=':
                    $orm->where_not_equal($column, $value);
                    break;
                case '>':
                    $orm->where_gt($column, $value);
                    break;
                case '>=':
                    $orm->where_gte($column, $value);
                    break;
                case '<':
                    $orm->where_lt($column, $value);
                    break;
                case '<=':
                    $orm->where_lte($column, $value);
                    break;
                case 'LIKE':
                    $orm->where_like($column, $value);
                    break;
                case 'NOT LIKE':
                    $orm->where_not_like($column, $value);
                    break;
            }
        }

        return $orm;
    }