*
* @param array $record
*
- * @return $this
+ * @return static
* @throws \CRM_Core_Exception
*/
public static function writeRecord(array $record): CRM_Core_DAO {
return $instance;
}
+ /**
+ * Bulk save multiple records
+ *
+ * @param array[] $records
+ * @return static[]
+ * @throws CRM_Core_Exception
+ */
+ public static function writeRecords(array $records) {
+ $results = [];
+ foreach ($records as $record) {
+ $results[] = static::writeRecord($record);
+ }
+ return $results;
+ }
+
/**
* Delete a record from supplied params.
*
* @param array $record
* 'id' is required.
- * @return CRM_Core_DAO
+ * @return static
* @throws CRM_Core_Exception
*/
public static function deleteRecord(array $record) {
return $instance;
}
+ /**
+ * Bulk delete multiple records.
+ *
+ * @param array[] $records
+ * @return static[]
+ * @throws CRM_Core_Exception
+ */
+ public static function deleteRecords(array $records) {
+ $results = [];
+ foreach ($records as $record) {
+ $results[] = static::deleteRecord($record);
+ }
+ return $results;
+ }
+
/**
* Check if there is a record with the same name in the db.
*