beyondcode / invoker-community

74 stars 2 forks source link

Call to undefined method Doctrine\DBAL\Connection::createSchemaManager() #332

Closed Nex-Otaku closed 1 year ago

Nex-Otaku commented 1 year ago

OS: win32 Invoker Version: 2.11.0 Laravel Version: 10.1.5 Local project: unknown PHP Binary: /usr/local/bin/php Route: /project/index?class=App%5CModule%5CIiko%5CIikoOrder&time=1677411135426&project=remote-duaiNzYPZpXSBHjAu5Cjsd

Error:

Error 

  Call to undefined method Doctrine\DBAL\Connection::createSchemaManager()

  at /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:1112
    1108▕     public function getDoctrineSchemaManager()
    1109▕     {
    1110▕         $connection = $this->getDoctrineConnection();
    1111▕ 
  ➜ 1112▕         return $connection->createSchemaManager();
    1113▕     }
    1114▕ 
    1115▕     /**
    1116▕      * Get the Doctrine DBAL database connection instance.

  1   phar:///tmp/root_invoker.phar/src/Factories/AttributeCollection.php:25
      Illuminate\Database\Connection::getDoctrineSchemaManager()

  2   phar:///tmp/root_invoker.phar/src/Factories/AttributeCollection.php:15
      _HumbugBox8e7f5be646a5\Invoker\Factories\AttributeCollection::getColumns("App\Module\Iiko\IikoOrder")
Ahrengot commented 1 year ago

Same for me.

OS: darwin Invoker Version: 2.11.0 Laravel Version: 10.0.0 Local project: true PHP Binary: /opt/homebrew/bin/php Route: /project/index?class=App%5CModels%5CUser&time=1677533484571&project=local-37Q645K83DNQqcPxJvEDJc

Error:

Error 

  Call to undefined method Doctrine\DBAL\Connection::createSchemaManager()

  at /Users/ahrengot/Valet Sites/agon-certificates/vendor/laravel/framework/src/Illuminate/Database/Connection.php:1112
    1108▕     public function getDoctrineSchemaManager()
    1109▕     {
    1110▕         $connection = $this->getDoctrineConnection();
    1111▕ 
  ➜ 1112▕         return $connection->createSchemaManager();
    1113▕     }
    1114▕ 
    1115▕     /**
    1116▕      * Get the Doctrine DBAL database connection instance.

  1   phar:/Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeCollection.php:25
      Illuminate\Database\Connection::getDoctrineSchemaManager()

  2   phar:/Applications/Invoker.app/Contents/Resources/invoker.phar/src/Factories/AttributeCollection.php:15
      _HumbugBox8e7f5be646a5\Invoker\Factories\AttributeCollection::getColumns("App\Models\User")
dqfan2012 commented 1 year ago

I'm having the same issue. Windows 11. Local project running with Windows Valet.

Invoker Version: 2.11.0 Laravel Version: 10.1.5 PHP Binary: C:/php/php.exe Route: /project/index?class=App%5CModels%5CUser&time=1677533484571&project=local-37Q645K83DNQqcPxJvEDJc

Exact same error as the two above.

mechelon commented 1 year ago

Can you all check your composer.lock file for the installed doctrine/dbal version? And which PHP version are you using?

marcreichel commented 1 year ago

I'm having the same issue.

Invoker Version: 2.11.0 Laravel Version: 10.1.5 PHP Version: 8.1.16 doctrine/dbal: 3.6.0

Nex-Otaku commented 1 year ago

Same as above.

It's a fresh installation, I created new project two weeks ago.

Invoker Version: 2.11.0 Laravel Version: 10.1.5 PHP Version: 8.1.16 doctrine/dbal Version: 3.6.0

mechelon commented 1 year ago

We were able to reproduce the bug and will release a fix soon. Thank you all!

jetwes commented 1 year ago

same here - can't do barely anything

saiht commented 1 year ago

Any updates for this error?

Ping @mechelon @mpociot

jetwes commented 1 year ago

Since i bought the license i can't use invoker at all...

sschlein commented 1 year ago

Hey, this will be fixed with an update in the next 2-3 hours – sorry for the delay and missing communication!

jetwes commented 1 year ago

Update available. Not working either.

jetwes commented 1 year ago

OS: darwin Invoker Version: 2.12.0 Laravel Version: 10.3.3 Local project: true PHP Binary: /opt/homebrew/bin/php Route: /project/index?class=App%5CModels%5CDomain&time=1678980332422&project=local-jZNTZYSDz4Dj3Cu1rXzi53

Error:


Error 

  Call to undefined method Doctrine\DBAL\Connection::createSchemaManager()
Ahrengot commented 1 year ago

The auto-updater in the app kept failing for me. It Never updated, just downloaded rebooted and told me there was an update.

I completely wiped Invoker from the system using Clean My Mac and downloaded from the website. Now it boots without any issues, but when previewing mail, which is my primary use case for invoker, I'm hitting this issue now instead: https://github.com/beyondcode/invoker-community/issues/331

marcreichel commented 1 year ago

Same here. The auto-updater failed which led to an unusable Invoker app. When starting it only shows a notification that Invoker is updating and will restart automatically. Which never happened. So I deleted Invoker completely and downloaded it again.

But the Doctrine error is still there:

image

OS: darwin Invoker Version: 2.12.0 Laravel Version: 10.1.5 Local project: unknown PHP Binary: /opt/homebrew/bin/php Route: /project/index?class=App%5CModels%5CIssue&time=1679302261698&project=remote-fN5hoomvKCBAdgrVuJ3YZg

Error:

In Connection.php line 1112:

  Call to undefined method Doctrine\DBAL\Connection::createSchemaManager()
mpociot commented 1 year ago

@marcreichel Could you help me figure out how to reproduce this? Could you paste the content of your composer.json file? I tried (so I thought) all possible Laravel + PHP + Doctrine version combinations, but looks like I missed something.

marcreichel commented 1 year ago

@mpociot Sure. When I open Invoker, navigate to one of my models and trying to refresh the model definition the error gets thrown.

An example composer.json from one of my projects currently looks like this:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.0",
        "laravel/sanctum": "^3.2",
        "laravel/socialite": "^5.5",
        "laravel/telescope": "^4.12",
        "laravel/tinker": "^2.7",
        "livewire/livewire": "^2.11",
        "pusher/pusher-php-server": "^7.2",
        "socialiteproviders/github": "^4.1",
        "doctrine/dbal": "^3.0"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.4",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.0",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force",
            "@php artisan telescope:publish --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}
mpociot commented 1 year ago

Thank you @marcreichel! Unfortunately, I can't reproduce it with the composer.json either.

Could you try the following:

Quit Invoker Delete ~/Library/Logs/Invoker/renderer.log Open Invoker and load your example project

If you then check the renderer.log file, you should see something like this:

[2023-03-20 10:20:56.793] [info]  Home :: checkLaravelVersion :: version ^10.0
[2023-03-20 10:20:56.793] [info]  Home :: checkLaravelVersion :: parsed version 10

And some lines further down:

[2023-03-20 10:20:56.806] [info]  Invoker :: invokerPath /Applications/Invoker.app/Contents/Resources/invoker_l10.phar

Could you see if it successfully detects the laravel version for you, and which phar filename it uses for the "invokerPath"?

marcreichel commented 1 year ago

@mpociot

Seems to be all fine:

[2023-03-20 11:04:13.939] [info]  Home :: checkLaravelVersion :: version ^10.0
[2023-03-20 11:04:13.939] [info]  Home :: checkLaravelVersion :: parsed version 10
[2023-03-20 11:04:13.952] [info]  Invoker :: invokerPath /Applications/Invoker.app/Contents/Resources/invoker_l10.phar
marcreichel commented 1 year ago

@mpociot I think I got it:

In a local project it is working just fine. The problem only occurs, when connecting via SSH to a project.

mpociot commented 1 year ago

@marcreichel When you connect via SSH, the renderer.log should show something similar:

[2023-03-20 11:09:07.227] [info]  SSH :: checkProject :: version ^10.0
[2023-03-20 11:09:07.228] [info]  SSH :: checkProject :: parsed version 10
[2023-03-20 11:09:07.228] [info]  SSH :: checkProject :: version ok
[2023-03-20 11:09:07.229] [info]  SSH :: uploadInvoker :: laravel version :: 10
[2023-03-20 11:09:07.229] [info]  SSH :: execute :: request test -f "/tmp/forge_10_invoker.phar" && echo "true" || echo "false"

Could you see if this is in your log file?

marcreichel commented 1 year ago

@mpociot

It is (including an additional empty execute line):

[2023-03-20 11:11:20.489] [info]  SSH :: checkProject :: version ^10.0
[2023-03-20 11:11:20.489] [info]  SSH :: checkProject :: parsed version 10
[2023-03-20 11:11:20.489] [info]  SSH :: checkProject :: version ok
[2023-03-20 11:11:20.489] [info]  SSH :: uploadInvoker :: laravel version :: 10
[2023-03-20 11:11:20.489] [info]  SSH :: execute ::
[2023-03-20 11:11:20.489] [info]  SSH :: execute :: request test -f "/tmp/forge_10_invoker.phar" && echo "true" || echo "false"
marcreichel commented 1 year ago

Wait a second. The error somehow disappeared and is not showing up anymore?! 🤔 It is now working both locally and remotely.

Maybe some sort of cache? 🤔

I've no idea what I might have changed except starting and quitting Invoker multiple times over the last minutes to check the log file. 😄

mpociot commented 1 year ago

Huh...those are the best kind of bugs 😂

Well...I'm glad it is now working for you. I'll still try to reproduce this locally by downgrading to the older version and see if I can trigger it somehow. Maybe it is some weird kind of cache 🤔

marcreichel commented 1 year ago

More of the weirdest kind of bugs imho 😄

Thanks for “sorting this out” somehow, nevertheless 👍🏼😄