1010use Ublaboo \DataGrid \Utils \DateTimeHelper ;
1111use Ublaboo \DataGrid \DataSource \IDataSource ;
1212
13- class QueryObjectDataSource implements IDataSource {
14-
15- use \Nette \SmartObject;
16-
17- /** @var \Kdyby\Doctrine\ResultSet */
13+ class QueryObjectDataSource implements IDataSource
14+ {
15+ /** @var \ADT\DoctrineComponents\ResultSet */
1816 protected $ resultSet ;
1917
20- /** @var \Kdyby\ Doctrine\EntityRepository */
18+ /** @var \Doctrine\ORM \EntityRepository */
2119 protected $ repo ;
2220
23- /** @var \Kdyby\Doctrine \QueryObject|IQueryObject */
21+ /** @var \ADT\DoctrineComponents \QueryObject|IQueryObject */
2422 protected $ queryObject ;
2523
2624 /** @var callable */
@@ -40,11 +38,11 @@ class QueryObjectDataSource implements IDataSource {
4038
4139 /**
4240 * QueryObjectDataSource constructor.
43- * @param \Kdyby\Doctrine \QueryObject $queryObject
44- * @param \Kdyby\ Doctrine\EntityRepository|null $repo
41+ * @param \ADT\DoctrineComponents \QueryObject $queryObject
42+ * @param \Doctrine\ORM \EntityRepository|null $repo
4543 * @throws \Exception
4644 */
47- public function __construct (\Kdyby \ Doctrine \QueryObject $ queryObject , \Kdyby \ Doctrine \EntityRepository $ repo = null )
45+ public function __construct (\ADT \ DoctrineComponents \QueryObject $ queryObject , \Doctrine \ ORM \EntityRepository $ repo = null )
4846 {
4947 if (!$ repo && (!$ queryObject instanceof IQueryObject)) {
5048 throw new \Exception ('"repo" must be set or "queryObject" has to implement IQueryObject interface. ' );
@@ -95,8 +93,7 @@ public function setLimitCallback($callback) {
9593
9694 protected function getResultSet () {
9795 if (!$ this ->resultSet ) {
98- $ this ->resultSet = $ this ->repo
99- ->fetch ($ this ->queryObject );
96+ $ this ->resultSet = $ this ->queryObject ->fetch ();
10097 }
10198
10299 return $ this ->resultSet ;
@@ -107,9 +104,7 @@ protected function getResultSet() {
107104 * @return int
108105 */
109106 public function getCount (): int {
110- return $ this ->repo
111- ->fetch ($ this ->queryObject )
112- ->getTotalCount ();
107+ return $ this ->queryObject ->fetch ()->getTotalCount ();
113108 }
114109
115110 /**
@@ -181,7 +176,7 @@ public function filterOne(array $filter): IDataSource {
181176 * @param int $limit
182177 * @return static
183178 */
184- public function limit ($ offset , $ limit ): IDataSource {
179+ public function limit (int $ offset , int $ limit ): IDataSource {
185180 $ defaultCallback = function () use ($ offset , $ limit ) {
186181 $ this ->getResultSet ()->applyPaging ($ offset , $ limit );
187182 };
0 commit comments