Announcement

Collapse
No announcement yet.

ESPO can't find entity

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

  • ESPO can't find entity

    I've created a custom module to support some backend work with a cron task. The Espo documentation is so incredibly sparse that I've spent hours and hours on this and am just spinning my wheels. I finally discovered an old blog entry referenced on a forum post somewhere here about creating a custom entity that gave me a piece (scope definition for entity) that I had overlooked in trying to copy what's in the Crm module to get this to work.

    Here's where I'm at (AAA represents the module name which I can't disclose due to internal business requirements)
    Structure:
    Modules\AAA\Entities\AAARecord.php - my entity.
    Modules\AAA\Resources\metadata\entityDefs\AAARecor d.json - this works correctly, as the rebuild process creates the table as expected.
    Modules\AAA\Resources\scopes\AAARecord.json - I just added this tonight
    Modules\AAA|Resources\module.json

    In my service I have the following code:
    PHP Code:
    $repository $this->getRepository('AAARecord');
    $collection $repository->find($selectParams); 
    And at this point, I get the following error:

    Code:
    PHP Fatal error: Call to a member function getEntityType() on null in /var/www/vhosts/AAA/application/Espo/ORM/DB/Mapper.php on line 104
    I've done an insane amount of debugging to track this down to the Entity Factory trying to map and create my entity within the Espo\Entities namespace, rather than mapping it to the correct namespace of Espo\Modules\AAA\Entities.

    Any assistance would be GREATLY appreciated. What am I missing here?
    Last edited by programmer01135; 09-29-2016, 05:22 AM.

  • #2
    As a quick follow-up, the entity is listed in the Administrative UI, and if I change the scope definition so that it's 'customizable', it gives me the ability to edit the fields under the correct scope. So it's being picked up correctly somewhere... just not in this backend code process.

    Comment


    • #3
      Maybe you need to define
      "module": "AAA"
      in metadata scopes.

      If it won't work try to rename your module to Aaa and entity to AaaRecord.

      Comment

      Working...
      X