invoker-community icon indicating copy to clipboard operation
invoker-community copied to clipboard

getDoctrineSchemaManager does not exist - Doctrine DBAL Removal

Open MCKLtech opened this issue 1 year ago • 1 comments

It would appear that Invoker is using DBAL, which is removed in 11.x

See: https://laravel.com/docs/11.x/upgrade#doctrine-dbal-removal


OS: darwin Invoker Version: 2.13.3 Laravel Version: 11.0.7 Local project: true PHP Binary: /Users/mckltech/Library/Application Support/Herd/bin/php Route: /project/index?class=App%5CModels%5CAction&time=1710789628041&project=local-kH4MRgULP3X84RqQ8KNXUc

Error:

BadMethodCallException 

  Method Illuminate\Database\PostgresConnection::getDoctrineSchemaManager does not exist.

  at /Users/mckltech/Development/xxxx-yyyy/vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:112
    108▕      */
    109▕     public function __call($method, $parameters)
    110▕     {
    111▕         if (! static::hasMacro($method)) {
  ➜ 112▕             throw new BadMethodCallException(sprintf(
    113▕                 'Method %s::%s does not exist.', static::class, $method
    114▕             ));
    115▕         }
    116▕

  i   Bad Method Call: Did you mean Illuminate\Database\PostgresConnection::getSchemaGrammar() ? 

  1   phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Factories/AttributeCollection.php:25
      Illuminate\Database\Connection::__call("getDoctrineSchemaManager", [])

  2   phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Factories/AttributeCollection.php:15
      _HumbugBoxe25921c35ed9\Invoker\Factories\AttributeCollection::getColumns("App\Models\Action")

MCKLtech avatar Mar 18 '24 19:03 MCKLtech

@MCKLtech , It's no longer needed, u can achieve the same thing using the code below for getting indexes of the column,

use Illuminate\Support\Facades\Schema;

private function hasIndex(string $table, string $column): bool
{
    $indexes = Schema::getIndexes($table);
    
    foreach ($indexes as $index) {
        if (in_array($column, $index['columns'])) {
            return true;
        }
    }

    return false;
}

muhammedjafer avatar Feb 12 '25 08:02 muhammedjafer