Announcement

Collapse
No announcement yet.

How to get a list of all users in ORM?

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

  • How to get a list of all users in ORM?

    How to get a list of all users in ORM?

    $this->getEntityManager()->getRepository('User')->find()

    This method returns an empty array...

  • #2
    sorry, can't reproduce. need more information
    (rebuild, check the log, file path, method)

    Comment


    • #3
      There are no errors in the error logs

      In this example, I'm trying to get the json line in the description field:

      namespace Espo\Jobs;

      use \Espo\Core\Exceptions;

      class TEstJobs extends \Espo\Core\Jobs\Base
      {
      public function run()
      {

      $whereClause = array(
      'name' => "1"
      );

      $tokenList = $this->getEntityManager()->getRepository('Meeting')->where($whereClause)->limit(0, 500)->find();
      foreach ($tokenList as $token) {
      $token->set('description', json_encode($this->getEntityManager()->getRepository('User')->find()));
      $this->getEntityManager()->saveEntity($token);
      }
      }
      }

      From other directories, without problems I receive the data

      Example:

      namespace Espo\Jobs;

      use \Espo\Core\Exceptions;

      class TEstJobs extends \Espo\Core\Jobs\Base
      {
      public function run()
      {

      $whereClause = array(
      'name' => "1"
      );

      $tokenList = $this->getEntityManager()->getRepository('Meeting')->where($whereClause)->limit(0, 500)->find();
      foreach ($tokenList as $token) {
      $token->set('description', json_encode($this->getEntityManager()->getRepository('Case')->find()));
      $this->getEntityManager()->saveEntity($token);
      }
      }
      }

      /

      Comment


      • #4
        check json_last_error_msg()
        for debug mode better to use $this->getEntityManager()->getRepository('User')->find()->toArray()

        Comment


        • #5
          So works:
          $this->getEntityManager()->getRepository('User')->find()->toArray()


          json_last_error_msg show "No error"

          Comment

          Working...
          X