* @return int
*/
public static function getMax($daoName, $fieldValues = NULL, $weightField = 'weight') {
+ if (empty($weightField)) {
+ Civi::log()->warning('Missing weight field name for ' . $daoName);
+ return 0;
+ }
+
$selectField = "MAX(ROUND($weightField)) AS max_weight";
$weightDAO = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$weightDAO->fetch();
* Field => value to be used in the WHERE.
* @param string $queryData
* Data to be used, dependent on the query type.
- * @param null $additionalWhere
- * @param string $orderBy
+ * @param string|null $additionalWhere
+ * Optional WHERE field.
+ * @param string|null $orderBy
* Optional ORDER BY field.
- *
- * @param null $groupBy
+ * @param string|null $groupBy
+ * Optional GROU{} BY field.
*
* @return CRM_Core_DAO
* objet that holds the results of the query
}
/**
- * @param $rows
+ * @param array $rows
* @param string $daoName
* @param string $idName
- * @param $returnURL
- * @param null $filter
+ * @param string $returnURL
+ * @param string|null $filter
*/
public static function addOrder(&$rows, $daoName, $idName, $returnURL, $filter = NULL) {
if (empty($rows)) {
}
/**
- * @param $url
+ * @param string $url
*/
public static function fixOrderOutput($url) {
if (empty($_GET['snippet']) || $_GET['snippet'] !== 'json') {