Queue XML/DAO/BAO - Add pseudoconstant for listing available types
authorTim Otten <totten@civicrm.org>
Fri, 21 Jan 2022 02:28:28 +0000 (18:28 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 21 Jan 2022 02:29:14 +0000 (18:29 -0800)
CRM/Queue/BAO/Queue.php [new file with mode: 0644]
CRM/Queue/DAO/Queue.php
xml/schema/Queue/Queue.xml

diff --git a/CRM/Queue/BAO/Queue.php b/CRM/Queue/BAO/Queue.php
new file mode 100644 (file)
index 0000000..4c5f027
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+/**
+ * Track a list of known queues.
+ */
+class CRM_Queue_BAO_Queue extends CRM_Queue_DAO_Queue {
+
+  /**
+   * Get a list of valid queue types.
+   *
+   * @return string[]
+   */
+  public static function getTypes($context = NULL) {
+    return [
+      'Memory' => ts('Memory (Linear)'),
+      'Sql' => ts('SQL (Linear)'),
+      'SqlParallel' => ts('SQL (Parallel)'),
+    ];
+  }
+
+}
index 5801c12b393bfbbc0c4c8f2446a92511c893912e..1cae113da080d0bed54126c05cd643d94297bee8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Queue/Queue.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a8717c39ea8ac6a7050400f33e42d64f)
+ * (GenCodeChecksum:08890bdce3ccfede0d5963b2a0a6fa98)
  */
 
 /**
@@ -90,7 +90,7 @@ class CRM_Queue_DAO_Queue extends CRM_Core_DAO {
           'where' => 'civicrm_queue.id',
           'table_name' => 'civicrm_queue',
           'entity' => 'Queue',
-          'bao' => 'CRM_Queue_DAO_Queue',
+          'bao' => 'CRM_Queue_BAO_Queue',
           'localizable' => 0,
           'html' => [
             'type' => 'Number',
@@ -109,7 +109,7 @@ class CRM_Queue_DAO_Queue extends CRM_Core_DAO {
           'where' => 'civicrm_queue.name',
           'table_name' => 'civicrm_queue',
           'entity' => 'Queue',
-          'bao' => 'CRM_Queue_DAO_Queue',
+          'bao' => 'CRM_Queue_BAO_Queue',
           'localizable' => 0,
           'html' => [
             'type' => 'Text',
@@ -127,11 +127,14 @@ class CRM_Queue_DAO_Queue extends CRM_Core_DAO {
           'where' => 'civicrm_queue.type',
           'table_name' => 'civicrm_queue',
           'entity' => 'Queue',
-          'bao' => 'CRM_Queue_DAO_Queue',
+          'bao' => 'CRM_Queue_BAO_Queue',
           'localizable' => 0,
           'html' => [
             'type' => 'Text',
           ],
+          'pseudoconstant' => [
+            'callback' => 'CRM_Queue_BAO_Queue::getTypes',
+          ],
           'add' => '5.47',
         ],
         'is_autorun' => [
@@ -142,7 +145,7 @@ class CRM_Queue_DAO_Queue extends CRM_Core_DAO {
           'where' => 'civicrm_queue.is_autorun',
           'table_name' => 'civicrm_queue',
           'entity' => 'Queue',
-          'bao' => 'CRM_Queue_DAO_Queue',
+          'bao' => 'CRM_Queue_BAO_Queue',
           'localizable' => 0,
           'html' => [
             'type' => 'CheckBox',
index e23c129b94089d2bbdbdb37bdcd0ed9a5d55ff67..176f70b0e3226d4cdeefa18841a479d391b82be7 100644 (file)
@@ -53,6 +53,9 @@
       <type>Text</type>
     </html>
     <add>5.47</add>
+    <pseudoconstant>
+      <callback>CRM_Queue_BAO_Queue::getTypes</callback>
+    </pseudoconstant>
   </field>
   <field>
     <name>is_autorun</name>