Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-159

Fix support for`whereAny` and `whereAll`

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Laravel

      ilejohn-official has created Issue #2757: `whereAny` and `whereAll` query Error in laravel-mongodb. This Jira ticket was filed by GromNaN

      Issue Text:

      • Laravel-mongodb Version: 4.1.x-dev
      • PHP Version: 8.2.14
      • Database Driver & Version:

      Description:

      The `whereAny` and `whereAll` query are not generating accurate mongo queries as it does in SQL. https://laravel.com/docs/10.x/queries#where-any-all-clauses

      Steps to reproduce

      1. perform a `whereAny` or `whereAll` query on a collection
      2. chain `toMql()` to see the query output

      Expected behaviour

      for example a `whereAny` query

      ```
      Model::whereAny(['title','text','shortcut','first_line'], 'like', '%p%')>toMql();
      ```
      should look like this
      ```
      [
      'find' => [
      '$or' => [
      ['title' => new \MongoDB\BSON\Regex('^.*\-p.*$', 'i')],
      ['text' => new \MongoDB\BSON\Regex('^.*\-p.*$', 'i')],
      ['shortcut' => new \MongoDB\BSON\Regex('^.*\-p.*$', 'i')],
      ['first_line' => new \MongoDB\BSON\Regex('^.*\-p.*$', 'i')],
      ],
      ],
      ]

      ```

      Actual behaviour

      Instead this is what I see

      ```
      [
      'find' => [
      'any' => [
      0 => ['title' => true],
      1 => ['text' => true],
      2 => ['shortcut' => true],
      3 => ['first_line' => true],
      ],
      ]
      ]
      ```

            Assignee:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: