Closed adelf closed 9 months ago
@adelf Its so awesome that the QueryBuilder methods finally work. Thanks! ❤️
But the ColumnDefinition
and IndexDefinition
classes seem not to work:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
// For $table->boolean('acl_admin') the initial() modifier is not suggested
// For $table->boolean('acl_admin')->initial(true) all following modifiers are not
// suggested anymore and code-inspect does not work
$table->boolean('acl_admin')
->initial(true)
->default(false);
// For $table->index(['acl_admin']) the where() modifier is not suggested
// For $table->index(['acl_admin'])->where('acl_admin = TRUE') all following modifiers are not
// suggested anymore and code-inspect does not work
$table->index(['acl_admin'])
->where('acl_admin = TRUE')
->algorithm('brin');
});
So, you will need to Laravel Idea Code Generation > Update ide.json metadata to load all changes: You probably forgot to make this and generate Helper Code after that. It works.
However, I don't like creating classes in the library just for IDE completions. Maybe better to add "mixinMethods" to the ide.json file? And Laravel Idea will add needed methods to the classes?
So, you will need to Laravel Idea Code Generation > Update ide.json metadata to load all changes
I extecuted that dozens of times. Together with the IDE helper re-generating all the stuff. I really don't understand how they interact with each other and what the correct sequence to call is. Or do I have to wait a few minutes after the ide.json update process?
However, I don't like creating classes in the library just for IDE completions. Maybe better to add "mixinMethods" to the ide.json file? And Laravel Idea will add needed methods to the classes?
I refactored it this way because then those new files are also helping PHPStan to know of these methods. I was able to remove some complex PHPStan extension code by that.
I've now installed this PR directly instead of fiddling with the files directly and running manual update commands. Still only the query builder suggestions do work. I don't know what I am doing wrong as this would be the standard way for everyone installing the package.
Sorry for the long response; I had a little vacation. Could you just reopen the project, Generate Helper code, and then take a look at vendor/_laravel_idea/_ide_helper_macro.php
There should be
namespace Illuminate\Database\Schema {
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\Blueprint
*/
class Blueprint {}
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\ColumnDefinition
*/
class ColumnDefinition {}
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\IndexDefinition
*/
class IndexDefinition {}
}
@adelf Its working - but very unreliable. I've deleted my project and recreated it and was presented with the blue PHP Storm bubble that I could run the Laravel Idea code generation. There I saw some progess bar working and everything works.
But nothing happens when I am running the Update ide.json data
command. But Generate Helper Code
works.
Hey. As promised, ide.json with new completions. I added only for Builder and Blueprint, maybe you will add some more.
It just adds
/** @mixin YourBuilder */ class DatabaseBuilder{}
during Laravwl Idea's Helper Code generation So, PhpStorm will complete this class methods.P.S. If you try to edit the ide.json file inside the vendor directory, Laravel Idea won't automatically load the changes. So, you will need to Laravel Idea Code Generation > Update ide.json metadata to load all changes:
It's only for your editing) users will fetch this file and all changes will be loaded automatically. They will need only to generate the helper file.