setTarget($target); $this->setValue($value); $this->setComparison($comparison); $this->setSearchQueryWriter($searchQueryWriter); } /** * @return SearchAdapterInterface */ public function getAdapter() { return $this->adapter; } /** * @param SearchAdapterInterface $adapter * @return $this */ public function setAdapter(SearchAdapterInterface $adapter) { $this->adapter = $adapter; return $this; } /** * @param string $ps * @return void * @throws \Exception */ public function appendPreparedStatementTo(&$ps) { $adapter = $this->getAdapter(); if (!$adapter instanceof SearchAdapterInterface) { throw new \Exception('No adapter has been applied to SearchCriteria'); } $ps .= $adapter->generateQueryString($this); } /** * String values should be passed into our filter string with quotation marks and escaping. * * @param string $value * @return string */ public function getQuoteValue($value) { if (is_string($value)) { return sprintf('"%s"', $value); } return $value; } /** * @return AbstractSearchQueryWriter */ public function getSearchQueryWriter() { return $this->searchQueryWriter; } /** * @param AbstractSearchQueryWriter $searchQueryWriter * @return $this */ public function setSearchQueryWriter($searchQueryWriter) { $this->searchQueryWriter = $searchQueryWriter; return $this; } /** * @return string */ public function getComparison() { return $this->comparison; } /** * @param string|null $comparison * @return $this */ protected function setComparison($comparison) { $this->comparison = $comparison; return $this; } /** * @return string */ public function getTarget() { return $this->target; } /** * @param string $target * @return $this */ protected function setTarget($target) { $this->target = $target; return $this; } /** * @return string|array */ public function getValue() { return $this->value; } /** * @param string|array $value * @return $this */ protected function setValue($value) { $this->value = $value; return $this; } }