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
8 changes: 3 additions & 5 deletions src/IQueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

interface IQueryObject
{

function orderBy($column, $value);

function searchIn($column, $value);
function orderBy(string $column, string $order = 'ASC');

function equalIn($column, $value);
function searchIn($column, $value, bool $strict = false);

function getEntityManager();
}
13 changes: 10 additions & 3 deletions src/QueryObjectDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ class QueryObjectDataSource implements IDataSource {
private $data;

/**
* QueryObjectDataSource constructor.
* @param \Kdyby\Doctrine\QueryObject $queryObject
* @param \Kdyby\Doctrine\EntityRepository $repo
* @param \Kdyby\Doctrine\EntityRepository|null $repo
* @throws \Exception
*/
public function __construct(\Kdyby\Doctrine\QueryObject $queryObject, \Kdyby\Doctrine\EntityRepository $repo) {
public function __construct(\Kdyby\Doctrine\QueryObject $queryObject, \Kdyby\Doctrine\EntityRepository $repo = null)
{
if (!$repo && (!$queryObject instanceof IQueryObject)) {
throw new \Exception('"repo" must be set or "queryObject" has to implement IQueryObject interface.');
}

$this->queryObject = $queryObject;
$this->repo = $repo;
$this->repo = $repo ?: $queryObject->getEntityManager();
}

/**
Expand Down