CRM-20312 regenerated DAOS with indexes
[civicrm-core.git] / CRM / Case / ManagedEntities.php
index ae9906b7d03973d1f37f18d8f42c5a3df5ba205f..382f9a05a7b3f0ac1e251591898eee4324c8e777 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * Class CRM_Case_ManagedEntities
+ */
 class CRM_Case_ManagedEntities {
 
   /**
@@ -52,11 +55,13 @@ class CRM_Case_ManagedEntities {
   }
 
   /**
-   * Get a list of managed activity-types by searching CiviCase XML files
+   * Get a list of managed activity-types by searching CiviCase XML files.
+   *
+   * @param \CRM_Case_XMLRepository $xmlRepo
+   * @param \CRM_Core_ManagedEntities $me
    *
    * @return array
    * @see CRM_Utils_Hook::managed
-   * @throws CRM_Core_Exception
    */
   public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
     $result = array();
@@ -94,17 +99,22 @@ class CRM_Case_ManagedEntities {
   }
 
   /**
-   * Get a list of managed relationship-types by searching CiviCase XML files
+   * Get a list of managed relationship-types by searching CiviCase XML files.
+   *
+   * @param \CRM_Case_XMLRepository $xmlRepo
+   * @param \CRM_Core_ManagedEntities $me
    *
    * @return array
    * @see CRM_Utils_Hook::managed
-   * @throws CRM_Core_Exception
    */
   public static function createManagedRelationshipTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
     $result = array();
 
-    $p = new CRM_Case_XMLProcessor();
-    $validRelTypes = $p->allRelationshipTypes();
+    if (!isset(Civi::$statics[__CLASS__]['reltypes'])) {
+      $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE, NULL);
+      Civi::$statics[__CLASS__]['reltypes'] = CRM_Utils_Array::collect(CRM_Case_XMLProcessor::REL_TYPE_CNAME, $relationshipInfo);
+    }
+    $validRelTypes = Civi::$statics[__CLASS__]['reltypes'];
 
     $relTypes = $xmlRepo->getAllDeclaredRelationshipTypes();
     foreach ($relTypes as $relType) {