@@ -523,11 +523,12 @@ try {
523
523
} catch (JiraException $e) {
524
524
$this->assertTrue(FALSE, "add Comment Failed : " . $e->getMessage());
525
525
}
526
-
527
526
```
528
527
529
528
#### Perform an advanced search
530
529
530
+ ** Simple Query**
531
+
531
532
``` php
532
533
<?php
533
534
require 'vendor/autoload.php';
@@ -545,9 +546,64 @@ try {
545
546
} catch (JiraException $e) {
546
547
$this->assertTrue(false, 'testSearch Failed : '.$e->getMessage());
547
548
}
549
+ ```
550
+
551
+
552
+
553
+ ** JQL with pagination**
554
+
555
+ ``` php
556
+ <?php
557
+ require 'vendor/autoload.php';
558
+
559
+ use JiraRestApi\Issue\IssueService;
560
+ use JiraRestApi\JiraException;
561
+
562
+ $jql = 'project not in (TEST) and assignee = currentUser() and status in (Resolved, closed)';
563
+
564
+ try {
565
+ $issueService = new IssueService();
548
566
567
+ $pagination = -1;
568
+
569
+ $startAt = 0; //the index of the first issue to return (0-based)
570
+ $maxResult = 3; // the maximum number of issues to return (defaults to 50).
571
+ $totalCount = -1; // the number of issues to return
572
+
573
+ // first fetch
574
+ $ret = $issueService->search($jql, $startAt, $maxResult);
575
+ $totalCount = $ret->total;
576
+
577
+ // do something with fetched data
578
+ foreach ($ret->issues as $issue) {
579
+ print (sprintf("%s %s \n", $issue->key, $issue->fields->summary));
580
+ }
581
+
582
+ // fetch remained data
583
+ $page = $totalCount / $maxResult;
584
+
585
+ for ($startAt = 1; $startAt < $page; $startAt++)
586
+ {
587
+ $ret = $issueService->search($jql, $startAt, $maxResult);
588
+
589
+ print ("\nPaging $startAt\n");
590
+ print ("-------------------\n");
591
+ foreach ($ret->issues as $issue) {
592
+ print (sprintf("%s %s \n", $issue->key, $issue->fields->summary));
593
+ }
594
+ }
595
+ } catch (JiraException $e) {
596
+ $this->assertTrue(false, 'testSearch Failed : '.$e->getMessage());
597
+ }
549
598
```
550
599
600
+
601
+
602
+
603
+
604
+
605
+
606
+
551
607
#### Issue time tracking
552
608
553
609
``` php
0 commit comments