Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Alternatively, you can manually include the files from the `src/` directory.
Here is a basic example of how to use the Criteria library:

```php
use Imponeer\Criteria\CriteriaItem;
use Imponeer\Criteria\CriteriaCompo;
use Imponeer\Database\Criteria\CriteriaItem;
use Imponeer\Database\Criteria\CriteriaCompo;

$criteria = new CriteriaCompo();
$criteria->add(new CriteriaItem('status', 'active'));
Expand Down
9 changes: 0 additions & 9 deletions src/CriteriaCompo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Exception;
use Imponeer\Database\Criteria\Enum\Condition;
use IteratorAggregate;
use Stringable;
use Traversable;

/**
Expand Down Expand Up @@ -109,12 +108,4 @@ public function render(bool $withBindVariables = false): ?string

return $ret;
}

/**
* @throws Exception
*/
public function __toString(): string
{
return $this->render() . 'A';
}
}
9 changes: 9 additions & 0 deletions src/CriteriaElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Imponeer\Database\Criteria;

use Exception;
use Imponeer\Database\Criteria\Traits\GroupByTrait;
use Imponeer\Database\Criteria\Traits\OrderByTrait;
use Imponeer\Database\Criteria\Traits\PartialResultsTrait;
Expand Down Expand Up @@ -89,4 +90,12 @@ public function __isset(string $name): bool
default => false,
};
}

/**
* @throws Exception
*/
public function __toString(): string
{
return $this->render(true) ?? '';
}
}
8 changes: 0 additions & 8 deletions src/CriteriaItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,4 @@ private function isEmptyArrayButNotNullComparison(mixed $value): bool
ComparisonOperator::NOT_BETWEEN,
], true);
}

/**
* @throws JsonException
*/
public function __toString(): string
{
return $this->render();
}
}
2 changes: 0 additions & 2 deletions src/Traits/PartialResultsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function setLimit(int $limit = 0): self
* Gets from what record number to return results (counting starts from 0)
*
* @noinspection MethodShouldBeFinalInspection
* @noinspection PhpDocSignatureInspection
*/
public function getStart(): int
{
Expand All @@ -53,7 +52,6 @@ public function getStart(): int
* @param int $start Sets start position
*
* @noinspection MethodShouldBeFinalInspection
* @noinspection PhpDocSignatureInspection
*/
public function setStart(int $start = 0): self
{
Expand Down
4 changes: 2 additions & 2 deletions tests/CriteriaItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class CriteriaItemTest extends TestCase
* Gets all possible comparison operators enums
*
* @return array<string, array{0: string, 1: mixed, 2: ComparisonOperator|string}>
* @throws RandomException
*
* @throws JsonException
*/
final public static function provideComparisonOperators(): array
{
$faker = Factory::create();

$column = $faker->sha1();
$column = 'field_' . $faker->word();
$specialOperators = [
ComparisonOperator::BETWEEN->name,
ComparisonOperator::NOT_BETWEEN->name,
Expand Down