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

laravel-mongodb - Issue #2715: Register the Mongo driver through the make function instead of resolving function

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Laravel

      zyz954489346 has created Issue #2715: Register the Mongo driver through the make function instead of resolving function in laravel-mongodb. This Jira ticket was filed by GromNaN

      Issue Text:

      • Laravel-mongodb Version: 4.1
      • PHP Version: 8.3
      • Database Driver & Version: 4

      Description:

      Register the Mongo driver through the make function instead of resolving functiong

      If db is instantiated in another package, then the callback function registered through resolving function will not be executed, which is a hidden BUG.

      This problem does not occur stably, only if a package is sorted by the composer and executes its own provider before the laravel-mongodb provider, and exactly instantiates db.

      The core code is:
      ![image](https://github.com/mongodb/laravel-mongodb/assets/23162012/bb9deb66-f7ac-49e9-876a-17beb1d221c3)

       In my project, the following code exists in other packages, which can lead to problems. Because db is instantiated in advance:
      ![image](https://github.com/mongodb/laravel-mongodb/assets/23162012/27c68fb2-b120-41f5-ad46-5afa43a84fd7)

      Problems caused by,there is an error:
      Unsupported driver [mongodb]. - InvalidArgumentException

       


      Workaround:
      User can change the order of registration of providers to work around this issue.

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: