How in ORM to receive result of the report on its id

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roman042
    Member
    • Jun 2017
    • 64

    How in ORM to receive result of the report on its id

    Hello, tell me how to get the ORM result of the report on its id ?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello

    Code:
    $reportService = $this->getServiceFactory()->create('Report');
    $reportResult = $reportService->run($id);

    Comment

    • roman042
      Member
      • Jun 2017
      • 64

      #3
      Returns an error in logs

      <?php

      namespace Espo\Custom\Services;

      use \Espo\ORM\Entity;

      class EntityPlanningService extends \Espo\Core\Services\Base
      {
      public function EntityPlanningServiceAction($workflowId, Entity $entity, array $additionalParameters = null)
      {

      $reportService = $this->getServiceFactory()->create('Report');
      $reportResult = $reportService->run($entity->get('reportId'));

      }
      }


      Espo.ERROR: Uncaught Exception Error: "Call to undefined method Espo\Custom\Services\EntityPlanningService::getSer viceFactory()" at /home/admin/web/*********/public_html/custom/Espo/Custom/Services/EntityPlanningService.php line 12 {"exception":"[object] (Error(code: 0): Call to undefined method Espo\\Custom\\Services\\EntityPlanningService::get ServiceFactory() at /home/admin/web/*********/public_html/custom/Espo/Custom/Services/EntityPlanningService.php:12)"} []

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        Code:
            protected function init()
            {
                parent::init();
                $this->addDependency('serviceFactory');
                ///...
            }
        
            protected function getServiceFactory()
            {
                return $this->injections['serviceFactory'];
            }

        Comment

        • roman042
          Member
          • Jun 2017
          • 64

          #5
          Thank you very much all earned)

          Comment

          Working...