Announcement

Collapse
No announcement yet.

Complex Field alias in select defs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Complex Field alias in select defs

    It is currently impossible to use the select section for fields within complex fields. There is no parent field parameter

    For example in address field:
    Code:
    "UpperCountry": {
          "type": "text",
          "maxLength": 255,
          "notStorable": true,
          "readOnly": true,
          "select": {
            "select": "UPPER:country",
            "this": "this"
          }
        }​
    don't transformes to table.fieldNameCountry.

    Of course, there are always additional loaders, but more concisely through ORM.

    Maybe somewhere here https://github.com/espocrm/espocrm/b...oser.php#L1474

    Or may be add field parameter "parent".

  • #2
    I do not understand. What is complex field. What is parent? Why not "UPPER:fieldNameCountry ?

    Comment


    • #3
      I'll try to explain

      If I want to make a universal handler that, in principle, processes fields, for example, of the “address” type, then when the select section is processed, there is no information about the virtual field that generated the real field in the ORM.

      And in order to use the name of the virtual field in the select section, it is necessary to enter the corresponding names in the select section for all entities that use the virtual field “address”. Or use loaders and not use the "select" section. It may be possible to redefine the ORM converter for a given field, but then you need to re-generate it for each field of the “Address” type, which is unacceptable.

      If some kind of service alias appears in the “select” section, referring to the name of the “virtual” field, then all the problems described above disappear and additional flexibility appears.​
      Attached Files

      Comment


      • #4
        Complex fields and ORM are in separate application layers. ORM isn't aware that complex fields exists. I wouldn't hurry to change it.

        You can define a custom converter for all Address fields: https://docs.espocrm.com/development...erterclassname

        Comment

      Working...
      X