/** * Add a Mapping. * * @param array $params * @return CRM_Core_DAO_Mapping * Mapping id of created mapping */ public function mappingCreate($params = NULL) { if ($params === NULL) { $params = array('name' => 'Mapping name', 'description' => 'Mapping description', 'mapping_type_id' => 7); } $mapping = new CRM_Core_DAO_Mapping(); $mapping->copyValues($params); $mapping->save(); // clear getfields cache CRM_Core_PseudoConstant::flush(); $this->callAPISuccess('mapping', 'getfields', array('version' => 3, 'cache_clear' => 1)); return $mapping; }
/** * Takes an associative array and creates a contact object. * * The function extract all the params it needs to initialize the create a * contact object. the params array could contain additional unused name/value * pairs * * @param array $params * An array of name/value pairs. * * @return object * CRM_Core_DAO_Mapper object on success, otherwise NULL */ public static function add($params) { $mapping = new CRM_Core_DAO_Mapping(); $mapping->copyValues($params); $mapping->save(); return $mapping; }