Retrieves all items matching the given criteria.

@param stdClass $params Associative array containing the parameters
@return array List of associative arrays with item properties, total number of items and success property
328447
public function searchItems( stdClass $params )
	{
		$manager = $this->_getManager();

		$total = 0;
		$search = $manager->createSearch();

		/** controller/extjs/locale/language/default/showall
		 * Displays all available languages in lists instead of only the used ones
		 *
		 * By default, all available languages are shown in the lists displaying
		 * languages in the administration interface, e.g. in text or media panels.
		 * The content of these lists can be limited to the languages used by the
		 * locales created for a site. This can help editors to manage content
		 * faster.
		 *
		 * @param boolean True for all languages, false for only the ones used by existing locales
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		if( !$this->_getContext()->getConfig()->get( 'controller/extjs/locale/language/default/showall', true ) )
		{
			$localeManager = MShop_Locale_Manager_Factory::createManager( $this->_getContext() );

			$langids = array();
			foreach( $localeManager->searchItems( $localeManager->createSearch() ) as $item ) {
				$langids[] = $item->getLanguageId();
			}

			if( !empty( $langids ) ) {
				$search->setConditions( $search->compare( '==', 'locale.language.id', $langids ) );
			}
		}

		$search = $this->_initCriteria( $search, $params );

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

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

		return array(
			'items' => $this->_toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
15670
public function deleteItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		foreach( (array) $params->items as $id ) {
			$this->getManager()->deleteItem( $id );
		}

		return array(
			'success' => true,
		);
	}
511136
public function get(array $params) {
        $this->_requireDataType($params);

        if (array_get($params, 'datatype') === self::METHOD_DICTIONARY) {
            return $this->getDictionary();
        } elseif (array_get($params, 'relatedType') && array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getRelatedResults($params);
        } elseif (array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getSingleResult($params);
        } else {
            list($response, $httpCode) = $this->_getIndex($params);
        }

        return $this->_formatResponse($response, $httpCode);
    }
709038
public function insertItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$ids = [];
		$manager = $this->getManager();

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$parentId = ( isset( $params->parentid ) ? $params->parentid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$manager->insertItem( $item, $parentId, $refId );

			$ids[] = $item->getId();
		}

		$this->clearCache( $ids );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', 'catalog.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );
		$items = $this->toArray( $manager->searchItems( $search ) );

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'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']);
    }
1027782
public function moveItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items', 'oldparentid', 'newparentid' ) );
		$this->_setLocale( $params->site );

		$manager = $this->_getManager();

		$ids = array();
		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$manager->moveItem( $entry, $params->oldparentid, $params->newparentid, $refId );
			$ids[] = $entry->id;
		}

		$this->_clearCache( $ids );

		return array(
			'success' => true,
		);
	}
330618
public function searchItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site' ) );
		$this->setLocale( $params->site );

		$total = 0;
		$search = $this->initCriteria( $this->getManager()->createSearch(), $params );

		if( isset( $params->domain ) && isset( $params->parentid )
			&& ( !isset( $params->options->showall ) || $params->options->showall == false ) )
		{
			$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $params->domain . '/lists' );
			$criteria = $listManager->createSearch();

			$expr = [];
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.parentid', $params->parentid );
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.domain', 'price' );
			$criteria->setConditions( $criteria->combine( '&&', $expr ) );

			$result = $listManager->searchItems( $criteria );

			$ids = [];
			foreach( $result as $items ) {
				$ids[] = $items->getRefId();
			}

			$expr = [];
			$expr[] = $search->compare( '==', 'price.id', $ids );
			$expr[] = $search->getConditions();
			$search->setConditions( $search->combine( '&&', $expr ) );
		}

		$items = $this->getManager()->searchItems( $search, [], $total );

		return array(
			'items' => $this->toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
729966
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$ids = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );
			$ids[] = $item->getId();
		}

		$this->clearCache( $ids );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', 'service.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );
		$result = $manager->searchItems( $search );

		foreach( $result as $item ) {
			$this->checkConfig( $item );
		}

		$items = $this->toArray( $result );

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
641904
public function moveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items', 'oldparentid', 'newparentid', 'refid' ) );

		$manager = $this->getManager();

		if( $params->newparentid === 'root' ) {
			$params->newparentid = null;
		}

		if( $params->refid === 'root' ) {
			$params->refid = null;
		}

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

		foreach( $items as $id ) {
			$manager->moveItem( $id, $params->oldparentid, $params->newparentid, $params->refid );
		}

		return array(
			'success' => true,
		);
	}
1220823
public function search($params)
    {
        $searchResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('searches'),
            $this->getSearchQuery($params)
        );

        return $this->getInputsFromSearchResult($searchResult);
    }
153025
public static function get($params = array())
	{
		$object = new static;
		$data   = $object->request('GET', $object->getUrl(), $params);
		$data   = $object->stripResponseData($data);

		// Initialise a collection
		$collection = self::newCollection();

		if (isset($data[0]) && is_array($data[0])) {
			// This should be a collection
			$collection->setItems($data);
		}

		return $collection;
	}
1183521
public function search($params)
    {
        $query = Area::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,
            'parent' => $this->parent,
            'sort' => $this->sort,
        ]);

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

        return $dataProvider;
    }
454685
public function moveItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'items', 'oldparentid', 'newparentid', 'refid' ) );

		$manager = $this->_getManager();

		if( $params->newparentid === 'root' ) {
			$params->newparentid = null;
		}

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry ) {
			$manager->moveItem( $entry, $params->oldparentid, $params->newparentid, $refId );
		}

		return array(
			'success' => true,
		);
	}
1310713
public function queryAll($params = array())
    {
        $this->mergeParams($params);
        $this->beginQuery();
        $rst = $this->statement->fetchAll(\PDO::FETCH_ASSOC);
        $this->statement->closeCursor();
        return $rst;
    }
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];
    }
818398
public function deleteItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		foreach( (array) $params->items as $id ) {
			$this->_getManager()->deleteItem( $id );
		}

		$this->_clearCache( (array) $params->items );

		return array(
			'items' => $params->items,
			'success' => true,
		);
	}
153672
public function search($params)
    {
        $query = ProductUnitEquivalent::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,
            'product_unit_1' => $this->product_unit_1,
            'product_unit_1_value' => $this->product_unit_1_value,
            'product_unit_2' => $this->product_unit_2,
            'product_unit_2_value' => $this->product_unit_2_value,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'created_by' => $this->created_by,
            'updated_by' => $this->updated_by,
        ]);

        return $dataProvider;
    }