New Entity Creation for Backend Use only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aldisa
    Junior Member
    • Jun 2023
    • 28

    New Entity Creation for Backend Use only

    I would like to create a new Entity called: EntityA
    which is located in a custom module which is called: MyModule.

    All MyModule code is located inside:
    Code:
    <espo-root>/custom/Espo/Modules/MyModule
    I have created the following files inside the Module folder specified above:

    File: Resources/metadata/scopes/EntityA.json
    PHP Code:
    {
      "entity": true,
      "layouts": false,
      "tab": false,
      "module": "MyModule"
    }
    Does it need anything else specified in scopes?

    File: Resources/metadata/entityDefs/EntityA.json
    PHP Code:
    {
      "fields": {
        /** define all fields with types etc here **/
    },
      "indexes": {
        /** define db indexes here **/
    }
    } 
    
    Is anything else required here?
    Does it need language definitions in Resources/i18n/<lang>/EntityA.json if no usage in Frontend (UI)?


    Code:
    Controllers/EntityA.php
    Entities/EntityA.php
    Repositories/EntityA.php
    Is it required to define any of the following class definition files which solely extend from Core Classes, if the only usage will be CRUD operations through the EntityManager Class?
  • yuri
    Member
    • Mar 2014
    • 8627

    #2
    No need for:
    • Controller
    • Language
    • Repository (not needed in 99% cases)
    • metadata/clientDefs
    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


    • aldisa
      aldisa commented
      Editing a comment
      Thanks for the clarification!
Working...