Towards CRM-19815 make pseudoconstant handling more generic.
Using metadata pseudoconstants we can remove joins on the option_value table, which hur performance. This patch
only opens it up within the context of the Contact table. It is intended to open the code up to
allow us to extend the performance advantage of dropping the bad join to other entities.
The following fields have metadata links to the
option_value table:
gender_id
prefix_id
suffix_id
preferred_communication_method
communication_style_id
preferred_language
The general pattern for the api is to return (eg) communication_style_id = 1, communication_style = 'Formal', where communication_style is the db name of the option group for communication_style_id.
preferred_communication_method is the exception. For api calls it returns an array of ids like all other api calls.
However, it returns a string of names for non-api calls on that field, allowing us to avoid handling it in a number of other places.
I added tests to ensure no change on the api inputs & outputs and searched these fields through search builder & advanced
search + export. I also checked profile search listings. They are not using the convert routine & have some e-notices that
pre-existed, but no regression I could see.