Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19925

Add metadata to fields array with entity info & date format info

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.15
    • Fix Version/s: 4.7.16
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      I have hit 3 cases recently where it would improve code if the fields array also told me the table, entity or BAO of the field. These have been in the search code primarily so a bunch of fields from different tables are in the array & having it state the details in each field makes code simpler.

      Per discussion with Tim - I think it's good to add / cache this info in the DAO field metadata. It does, as Tim pointed out, increase the size of the array - but we are not generally passing large metadata arrays by ajax. Once the functionality is being used extensions may wish to regenerate their DAOs to leverage it but I don't see any imminent driver for them to do so.

      ON review of one of the instances I see Yashi has added entity to the pseudoconstant - https://github.com/civicrm/civicrm-core/pull/9665
      I'm trying to think whether that would make more sense - it would only be sometimes available & I'm inclined to think the downside of it being 'always there' is not substantive & it would be more logical. (My other current use_case did indeed deal with a pseudoconstant so putting it there would work for that but I'm still leaning against it just for 'having the same thing for every field'. I also think we should add 'data_type' to the fields array & that data_type should be equivalent to the same field on custom fields - although I'm leaving that out of scope

      I have also added 'format' to the 'html' array for date fields - allowing us to move field definition to the metadata

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: