dev/core#2486 Add survey v4 api
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 2 Sep 2021 23:34:45 +0000 (11:34 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 3 Sep 2021 06:07:36 +0000 (18:07 +1200)
CRM/Campaign/DAO/Survey.php
Civi/Api4/Survey.php [new file with mode: 0644]
tests/phpunit/api/v3/SyntaxConformanceTest.php
xml/schema/Campaign/Survey.xml

index b46e6235c0b676e44a78e005b91909faeba9b60e..bc051c862cde889ed1e68faf57ba3fb81964ea9e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/Survey.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:45c10db72afe877c41ddb78b79153648)
+ * (GenCodeChecksum:8fec5a0ffb4667af4f00820de74aa577)
  */
 
 /**
@@ -474,6 +474,13 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
           'entity' => 'Survey',
           'bao' => 'CRM_Campaign_BAO_Survey',
           'localizable' => 0,
+          'pseudoconstant' => [
+            'table' => 'civicrm_option_group',
+            'keyColumn' => 'id',
+            'labelColumn' => 'title',
+            'nameColumn' => 'name',
+            'condition' => 'name LIKE "civicrm_survey_%"',
+          ],
           'add' => '3.3',
         ],
         'bypass_confirm' => [
diff --git a/Civi/Api4/Survey.php b/Civi/Api4/Survey.php
new file mode 100644 (file)
index 0000000..c4cb0d4
--- /dev/null
@@ -0,0 +1,23 @@
+<?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       |
+ +--------------------------------------------------------------------+
+ */
+namespace Civi\Api4;
+
+/**
+ * Survey entity.
+ *
+ * @see https://docs.civicrm.org/user/en/latest/survey/what-is-civisurvey/
+ * @searchable secondary
+ * @since 5.43
+ * @package Civi\Api4
+ */
+class Survey extends Generic\DAOEntity {
+
+}
index d5917363950a5a78e0e17834be34011ce65eec5e..b9d496bb9480c41b7618046cbe6d548bbf40f9c7 100644 (file)
@@ -538,6 +538,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
       'Logging',
       // Skip message template because workflow_id/workflow_name are sync'd.
       'MessageTemplate',
+      // Skip survey because the pseudoconstant will have no options.
+      'Survey',
     ];
     if ($sequential === TRUE) {
       return $entitiesWithout;
index e57a3b1f4def2e7683be1cfe42d67502932790dc..0433f898b57cbe3ade2d90fe781bdee570803942 100644 (file)
     <default>NULL</default>
     <comment>Used to store option group id.</comment>
     <add>3.3</add>
+    <pseudoconstant>
+      <table>civicrm_option_group</table>
+      <keyColumn>id</keyColumn>
+      <labelColumn>title</labelColumn>
+      <nameColumn>name</nameColumn>
+      <condition>name LIKE "civicrm_survey_%"</condition>
+    </pseudoconstant>
   </field>
   <field>
     <name>bypass_confirm</name>