How fetch entity inside custom service action for workflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvera
    Junior Member
    • Mar 2017
    • 1

    How fetch entity inside custom service action for workflow

    Hi,
    im trying to fetch record inside custom service action for workflow. I follow this example https://www.espocrm.com/features/add...-for-workflow/
    but now i cant fetch data inside this class.

    PHP Code:
    
    $app = new \Espo\Core\Application();
    
    $entityManager = $app->getContainer()->get('entityManager');  
    
    $accountList = $entityManager->getRepository('Account')->limit(0, 2)->find();  
    
    // $accountList is empty and i have a lot of account created 
    
    Thanks
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    why did you create an object $app?
    entity manager is available from service with calling $this->getEntityManager()

    Describe all files, you created, and content of files

    Comment

    Working...