88
99namespace sokyrko \yii \salesforce \data ;
1010
11- use Akeneo \SalesForce \Connector \SalesForceClient ;
12- use Akeneo \SalesForce \Query \QueryBuilder ;
1311use sokyrko \yii \salesforce \components \SalesforceComponent ;
1412use yii \base \InvalidCallException ;
1513use yii \base \InvalidParamException ;
@@ -43,6 +41,7 @@ class ActiveQuery implements ActiveQueryInterface
4341 'where ' => [],
4442 'orderBy ' => [],
4543 'limit ' => '' ,
44+ 'offset ' => '' ,
4645 ];
4746
4847 /**
@@ -95,6 +94,8 @@ protected function parseSelect($what)
9594 public function asArray ($ value = true )
9695 {
9796 $ this ->asArray = $ value ;
97+
98+ return $ this ;
9899 }
99100
100101 /**
@@ -247,7 +248,15 @@ public function getRawQuery()
247248 $ q ->orderBy ($ this ->parseOrderBy ($ this ->queryParts ['orderBy ' ]));
248249 }
249250
250- // TODO: support limit and join
251+ if ($ this ->queryParts ['limit ' ]) {
252+ $ q ->limit ($ this ->queryParts ['limit ' ]);
253+ }
254+
255+ if ($ this ->queryParts ['offset ' ]) {
256+ $ q ->offset ($ this ->queryParts ['offset ' ]);
257+ }
258+
259+ // TODO: support join
251260
252261 return $ q ->getQuery ();
253262 }
@@ -527,7 +536,7 @@ public function addOrderBy($columns)
527536 */
528537 public function limit ($ limit )
529538 {
530- $ this ->queryParts ['limit ' ][] = $ limit ;
539+ $ this ->queryParts ['limit ' ] = $ limit ;
531540
532541 return $ this ;
533542 }
@@ -540,7 +549,9 @@ public function limit($limit)
540549 */
541550 public function offset ($ offset )
542551 {
543- throw new InvalidCallException ('Not implemented yet. ' );
552+ $ this ->queryParts ['offset ' ] = $ offset ;
553+
554+ return $ this ;
544555 }
545556
546557 /**
0 commit comments