alpha2 (#2)
- Change multiple field matching to enum - Implement auto-generated IDs Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace BitBadger\PDODocument\Query;
|
||||
|
||||
use BitBadger\PDODocument\{Field, Query};
|
||||
use BitBadger\PDODocument\{DocumentException, Field, FieldMatch, Query};
|
||||
|
||||
/**
|
||||
* Queries for counting documents
|
||||
@@ -25,11 +25,12 @@ class Count
|
||||
*
|
||||
* @param string $tableName The name of the table in which documents should be counted
|
||||
* @param Field[] $fields The field comparison to match
|
||||
* @param string $conjunction How to handle multiple conditions (optional; defaults to `AND`)
|
||||
* @param FieldMatch|null $match How to join multiple conditions (optional; defaults to All)
|
||||
* @return string The query to count documents using a field comparison
|
||||
* @throws DocumentException If the database mode has not been set
|
||||
*/
|
||||
public static function byFields(string $tableName, array $fields, string $conjunction = 'AND'): string
|
||||
public static function byFields(string $tableName, array $fields, ?FieldMatch $match = null): string
|
||||
{
|
||||
return self::all($tableName) . ' WHERE ' . Query::whereByFields($fields, $conjunction);
|
||||
return self::all($tableName) . ' WHERE ' . Query::whereByFields($fields, $match);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user