convert Base Entity to BasePlus Entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    convert Base Entity to BasePlus Entity

    Hello,

    some one have a best way to convert entity Base to BasePlus ?
    it's a existing entity with many record

    Thanks
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Hello friend,

    The only difference that I could tell between a Base entity and a BasePlus entity is that BasePlus has links to Meeting, Task, Email and Call and Base entity does not.

    To transform a Base entity into a BasePlus entity try this:

    In your custom entity entityDefs script (for example: custom/Espo/Custom/Resources/metadata/entityDefs/YourEntity.json), add the following code under the section "links":
    Code:
    "links": {
    
       (existing code)
    
       "meetings": {
          "type": "hasMany",
          "entity": "Meeting",
          "foreign": "parent",
          "layoutRelationshipsDisabled": true
       },
       "calls": {
          "type": "hasMany",
          "entity": "Call",
          "foreign": "parent",
          "layoutRelationshipsDisabled": true
       },
       "tasks": {
          "type": "hasChildren",
          "entity": "Task",
          "foreign": "parent",
          "layoutRelationshipsDisabled": true
       },
       "emails": {
          "type": "hasChildren",
          "entity": "Email",
          "foreign": "parent",
          "layoutRelationshipsDisabled": true
       }
    }
    Add the following code to the custom entity clientDefs script (for example: custom/Espo/Custom/Resources/metadata/clientDefs/YourEntity.json):
    Code:
    "sidePanels": {
       "detail": [
          {
             "name": "activities",
             "label": "Activities",
             "view": "crm:views/record/panels/activities",
             "aclScope": "Activities"
          },
          {
             "name": "history",
             "label": "History",
             "view": "crm:views/record/panels/history",
             "aclScope": "Activities"
          },
          {
             "name": "tasks",
             "label": "Tasks",
             "view": "crm:views/record/panels/tasks",
             "aclScope": "Task"
          }
       ]
    }
    After making the above modifications, clear cache and rebuild.

    Best Regards

    Comment


    • item
      item commented
      Editing a comment
      Many Thanks friend

      i think one more think to do :

      in custom/Entities : change Base to BasePlus .. i don't know if it's important

      ....extends \Espo\Core\Templates\Entities\BasePlus

    • telecastg
      telecastg commented
      Editing a comment
      No need, both Espo\Core\Templates\Entities\Base and Espo\Core\Templates\Entities\BasePlus extend from \Espo\Core\ORM\Entity without implementing any class methods, so they are identical
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #3
    There was another guide on this topic too but telecastg explain it much more clearly.

    --

    For reference though: https://github.com/o-data/EspoCRM-Le...nd-Design/wiki
    Change/convert Entity type from Base to Base Plus (BasePlus) - https://forum.espocrm.com/forum/gene...age2#post71092 | https://forum.espocrm.com/forum/deve...tity#post75468

    --- Riskier method as follow:
    Considering if you delete an entity the record doesn't get deleted... I wonder if this trick can help... Delete entiy, create entity with same name but this time as BasePlus, it might work or it might crash.

    Comment

    Working...