We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aac252d commit f3a15cbCopy full SHA for f3a15cb
src/Database/Query/FMBaseBuilder.php
@@ -716,5 +716,27 @@ public function setGlobalFields(array $globals){
716
$this->globalFields = $globals;
717
return $this->connection->setGlobalFields($this);
718
}
719
+ /**
720
+ * Retrieve the "count" result of the query.
721
+ *
722
+ * @param string $columns
723
+ * @return int
724
+ */
725
+ public function count($columns = '*')
726
+ {
727
+ $this->limit(1);
728
+ try {
729
+ $result = $this->connection->performFind($this);
730
+ } catch (FileMakerDataApiException $e){
731
+ if ($e->getCode() === 401){
732
+ // no records found - this is ok
733
+ // return 0
734
+ return 0;
735
+ }
736
737
+
738
+ $count = $result['response']['dataInfo']['foundCount'];
739
+ return (int) $count;
740
741
742
0 commit comments