/** * Method to retrieve all entities by filters * * @param int $start * @param int $limit * @param array $filterArguments * @param string $sortingField * @param $sortingType * @return AbstractEntityCollection * @throws InvalidArgumentException */ public function getAllByFilters($start = 0, $limit = 10, array $filterArguments = array(), $sortingField = '', $sortingType = AbstractRestBackend::SORTING_DESC) { if (!is_integer($start)) { throw new InvalidArgumentException('Method "' . __METHOD__ . '" accepts only integer values as $start. Input was: ' . serialize($start)); } if (!is_integer($limit)) { throw new InvalidArgumentException('Method "' . __METHOD__ . '" accepts only integer values as $limit. Input was: ' . serialize($limit)); } if (!is_array($filterArguments)) { throw new InvalidArgumentException('Method "' . __METHOD__ . '" accepts only integer values as $filterArguments. Input was: ' . serialize($filterArguments)); } if (!is_string($sortingField)) { throw new InvalidArgumentException('Method "' . __METHOD__ . '" accepts only string values as $sortingField. Input was: ' . serialize($sortingField)); } if (!is_string($sortingType)) { throw new InvalidArgumentException('Method "' . __METHOD__ . '" accepts only string values as $sortingType. Input was: ' . serialize($sortingType)); } $filterCollection = $this->filterCollectionFactory->createFromFilterArguments($filterArguments); return $this->getAllByFilterCollection($start, $limit, $filterCollection, $sortingField, $sortingType); }
/** * @test */ public function testCanBuildFilterCollectionForDuration() { $arguments = array('severity' => array('severityStart' => 10, 'severityEnd' => 20)); $filterCollection = $this->instance->createFromFilterArguments($arguments); $this->assertEquals('&severityStart=10&severityEnd=20', $filterCollection->getFilterStringFromAll(), 'Could not build filterCollection with expected filter string'); }