Orm help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alasdaircr
    Active Community Member
    • Aug 2014
    • 525

    Orm help

    Hi I've noticed after adding a new Entity type that the names for the join tables to other entities varies and this is the case for the existing modules:

    eg these exist by default:

    lead_meeting

    meeting_user

    this means it's hard to write shared code where you can reference tables using something like {$scope}_meeting

    Where could I fix this?
  • yuri
    Member
    • Mar 2014
    • 8455

    #2
    use relationName in links definitions


    PHP Code:
    "links": {
            "contracts": {
                "type": "hasMany",
                "entity": "Contract",
                "relationName": "AccountContract"
            }
    } 
    
    That will create account_contract table

    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8455

      #3
      It's a commonly used standard where join table parts are sorted aplhabeticaly
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • alasdaircr
        Active Community Member
        • Aug 2014
        • 525

        #4
        Ah thanks, I totally wasn't aware of that standard, and since posting saw how it's handled with $joinTable in Modules/Crm/Services/Activities.php.

        Comment

        Working...