Add pseudoconstant for Relationship.relationship_type_id
[civicrm-core.git] / CRM / Contact / BAO / RelationshipType.php
index 6c44ea5900dcf7638d3d78de5cc38b4dd1721314..7515f4f14d5da3b1e0809a69824070e5789fd4a1 100644 (file)
@@ -85,18 +85,11 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
     }
 
     // action is taken depending upon the mode
-    $relationshipType = new CRM_Contact_DAO_RelationshipType();
-
-    $hook = empty($params['id']) ? 'create' : 'edit';
-    CRM_Utils_Hook::pre($hook, 'RelationshipType', CRM_Utils_Array::value('id', $params), $params);
-
-    $relationshipType->copyValues($params);
-    $relationshipType->save();
-
-    CRM_Utils_Hook::post($hook, 'RelationshipType', $relationshipType->id, $relationshipType);
+    $relationshipType = self::writeRecord($params);
 
     CRM_Core_PseudoConstant::relationshipType('label', TRUE);
     CRM_Core_PseudoConstant::relationshipType('name', TRUE);
+    CRM_Core_PseudoConstant::flush();
     CRM_Case_XMLProcessor::flushStaticCaches();
     return $relationshipType;
   }