Finds and returns all grade_category instances based on params.

@param array $params associative arrays varname=>value
@return array array of grade_category insatnces or false if none found.
507471
public static function fetch_all($params) {
        if ($records = self::retrieve_record_set($params)) {
            return $records;
        }

        $records = grade_object::fetch_all_helper('grade_categories', 'grade_category', $params);
        self::set_record_set($params, $records);

        return $records;
    }
1252145
public static function listAllCategoriesAsync(array $parameters = [])
    {
        return self::listAllCategoriesAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
581404
private function extractSorting(array $params)
    {
        if (false === $this->issetNotEmpty(self::PARAM_SORTING, $params)) {
            return $this;
        }
        $sort = explode(',', $params[self::PARAM_SORTING]);
        $this->sorting = [];
        foreach ($sort as $field) {
            $direction = 1;
            if (0 === strpos($field, '-')) {
                $direction = -1;
                $field = str_replace('-', '', $field);
            }
            $this->sorting[$field] = $direction;
        }
        return $this;
    }
736994
public function getCategoryValues($asArray = null)
    {
        if (!$this->owner->getIsNewRecord() && $this->_categoryValues === null) {
            $this->_categoryValues = [];

            /* @var ActiveRecord $category */
            foreach ($this->owner->{$this->categoryRelation} as $category) {
                $this->_categoryValues[] = $category->getAttribute($this->categoryValueAttribute);
            }
        }

        if ($asArray === null) {
            $asArray = $this->categoryValuesAsArray;
        }

        if ($asArray) {
            return $this->_categoryValues === null ? [] : $this->_categoryValues;
        } else {
            return $this->_categoryValues === null ? '' : implode(', ', $this->_categoryValues);
        }
    }
447491
public function getTree( stdClass $params )
	{
		$this->_checkParams( $params, array( 'items' ) );

		$manager = $this->_getManager();

		$result = array();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			if( $entry == 'root' )
			{
				$search = $this->_manager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );

				$item = $this->_manager->createItem();
				$item->setLabel( 'Root' );

				foreach( $this->_manager->searchItems( $search ) as $siteItem ) {
					$item->addChild( $siteItem );
				}
			}
			else
			{
				$item = $manager->getTree( $entry, array(), MW_Tree_Manager_Abstract::LEVEL_LIST );
			}

			$result[] = $this->_createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
914051
public function all(array $params = array())
    {
        $endpoint = '/admin/products.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Product::class, $response['products']);
    }
1355416
public function filterItineraryParamsToPropagate($params)
    {
        $res = [];

        foreach ($params as $key => $value) {
            if (!empty($value) && is_string($value)) {
                $res[$key] = $value;
            }
        }

        return $res;
    }
454966
public function all(array $params = array())
    {
        $endpoint = '/admin/orders.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Order::class, $response['orders']);
    }
438496
public function fetchArray($params = false)
    {
        if (\count($this->values) === 0) {
            return false;
        }
        if (\count($this->values) > 1) {
            return $this->values;
        }
        if ($params === true) {
            return $this->values;
        }
        if (\is_array($params) && array_key_exists('item', $params)) {
            $item = $params['item'];
            if (array_key_exists($item, $this->values)) {
                return $this->values[$item];
            }
            if (array_key_exists($item, $this->values[0])) {
                return $this->values[0][$item];
            }
            return false;
        }

        return $this->values[0];
    }
1195624
public function search($params)
    {
        $query = Rating::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'item_id' => $this->item_id,
            'service_id' => $this->service_id,
            'user_id' => $this->user_id,
            'rating' => $this->rating,
            'update_time' => $this->update_time,
            'creation_time' => $this->creation_time,
        ]);

        $query->andFilterWhere(['like', 'ip', $this->ip]);

        return $dataProvider;
    }
348488
public function getNbResults($params = array())
    {

        if ( isset( $this->nbResults ) )
        {
            return $this->nbResults;
        }
        $this->nbResults = $this->handler->searchCount( $this->form, $this->criteriaBuilder, $params );
        return $this->nbResults;
    }
107202
public function search($params)
    {
        $query = WarehouseVoucherItems::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }
        $query->andFilterWhere([
            'id'                   => $this->id,
            'warehouse_voucher'    => $this->warehouse_voucher,
            'warehouse_product'    => $this->warehouse_product,
            'product_unit'         => $this->product_unit,
            'product_unit_price'   => $this->product_unit_price,
            'quantity'             => $this->quantity,
            'supplier_quantity'    => $this->quantity,
            'supplier_total_price' => $this->supplier_total_price,
            'total_price'          => $this->total_price,
            'created_at'           => $this->created_at,
            'updated_at'           => $this->updated_at,
            'created_by'           => $this->created_by,
            'updated_by'           => $this->updated_by,
        ]);
        $query->andFilterWhere([
            'like',
            'currency_unit',
            $this->currency_unit,
        ]);

        return $dataProvider;
    }
832269
public function setParamsSort(array $params) {
        if (is_numeric(key($params)) && key($params) == 0) {
            $tmp = [];
            foreach ($params as $key => $value) {
                $tmp[$key + 1] = $value;
            }
            $params = $tmp;
        }

        return $params;
    }
431657
public function searchItems( stdClass $params )
	{
		$total = 0;
		$search = $this->_initCriteria( $this->_getManager()->createSearch(), $params );

		$sort = $search->getSortations();
		$sort[] = $search->sort( '+', 'locale.currency.label' );
		$search->setSortations( $sort );

		$items = $this->_getManager()->searchItems( $search, array(), $total );

		return array(
			'items' => $this->_toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
848067
public function getTree( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		$manager = $this->_getManager();

		$result = array();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$entry = ( $entry != 'root' ? $entry : null );
			$item = $manager->getTree( $entry, array(), MW_Tree_Manager_Abstract::LEVEL_LIST );
			$result[] = $this->_createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
903226
public function search($params)
    {
        $query = Question::find()->orderBy(['created_at' => SORT_DESC]);

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'price' => $this->price,
            'hide' => $this->hide,
            'answers' => $this->answers,
            'views' => $this->views,
            'followers' => $this->followers,
            'collections' => $this->collections,
            'comments' => $this->comments,
            'status' => $this->status,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'alias', $this->alias])
            ->andFilterWhere(['like', 'content', $this->content]);

        return $dataProvider;
    }
536918
protected function _getRelatedResults(array $params) {
        // Check for existence of the subject record first, in order to return a 404 error
        list($subjectRecord, $httpCode) = $this->_getSingleResult($params);
        if (!$subjectRecord['success']) {
            return array(
                array(
                    'success' => false,
                    'result' => array()
                ),
                404
            );
        }

        $schema = new Garp_Content_Api_Rest_Schema('rest');
        $relation = $schema->getRelation($params['datatype'], $params['relatedType']);
        list($rule1, $rule2) = $relation->getRules($params['datatype']);

        $contentManager = $this->_getContentManager($relation->model);
        $subjectId = $params['id'];
        unset($params['id']);
        $options = $this->_extractOptionsForFetch($params);
        $options['query'][ucfirst($params['datatype']) . '.id'] = $subjectId;
        $options['bindingModel'] = $relation->getBindingModel()->id;
        $options['rule'] = $rule1;
        $options['rule2'] = $rule2;
        $options['fields'] = Zend_Db_Select::SQL_WILDCARD;

        if ($contentManager->getModel()->isMultilingual()) {
            $options['joinMultilingualModel'] = true;
        }
        $records = $contentManager->fetch($options);
        $amount = count($records);
        $records = array($params['relatedType'] => $records);
        if (isset($options['with'])) {
            $records = $this->_combineRecords($params['relatedType'], $records, $options['with']);
        }
        return array(
            array(
                'success' => true,
                'result' => $records,
                'amount' => $amount,
                'total' => intval($contentManager->count($options))
            ),
            200
        );
    }