krlove / eloquent-model-generator

Eloquent Model Generator
MIT License
725 stars 188 forks source link

There are no commands defined in the "krlove:generate" namespace #43

Closed Banzai292 closed 3 years ago

Banzai292 commented 6 years ago

I follow the instructions until Step 2, that is not clear enough, where to put this line. My environment (Windows 7 Pro x64):

I've created a test project with

$\composer>composer create-project --prefer-dist laravel/lumen ..\lumen\test
Installing laravel/lumen (v5.6.0)
  - Installing laravel/lumen (v5.6.0): Downloading (100%)
Created project in ..\lumen\test

These are the installed versions I got:

$>composer --version
Composer version 1.7.2 2018-08-16 16:57:12

$>php artisan --version
Laravel Framework Lumen (5.6.4) (Laravel Components 5.6.*)

$>php -version
PHP 7.1.19RC1 (cli) (built: Jun  8 2018 20:11:53) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

(BTW: all in Visual Studio Code Terminal with project 'cd' into project directory. Extensions 'Composer' and 'PHP Extension Pack')

I found the "provider= ["-thingi in 'composer.lock' and 'vendor\composer\installed.json, but without '::class', written from installation, I think.

The file 'GenerateModelComposer.php' (and many more) are available in project directory (.\vendor\krlove\eloquent-model-generator... etc)

My database connection is NOT on localhost, but on a verified extern accessible PostgreSQL 10 (I've successful connections from local development system to this database with pgDbAdmin or DBeaver). I activate the extension in my php.ini (single php_pdo_pgsql.dll and php_pgsql.dll and both)

But generation fails:

$>php artisan krlove:generate:model Device --table-name=DEVICE

  There are no commands defined in the "krlove:generate" namespace.

I try all variations of the --table-name option: with quotes, without quotes, with schema.table or schema."table", but this seems not to be the problem.

I'm out of ideas, what to do next.

infografik commented 5 years ago

table eg: my_models command: php artisan krlove:generate:model MyModel --namespace=MyNameSpace result: [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "krlove:generate" namespace. The reason for the error: Incorrect entry or no entry in config / app.php - section 'providers' Krlove\EloquentModelGenerator\Provider\GeneratorServiceProvider::class

victor-sog commented 5 years ago

Ensure you've added the provider below in the config/app.php folder and ensure your table exists. 'providers' => [ // ... Krlove\EloquentModelGenerator\Provider\GeneratorServiceProvider::class, ];

restroika commented 5 years ago

in my case (using "laravel/lumen-framework": "5.8.*"), the solution needed GeneratorServiceProvider to be add on config/app.php but in another way : $app->register(\Krlove\EloquentModelGenerator\Provider\GeneratorServiceProvider::class);

then please check out your owner table PG, first i create table using PGAdmin but owner to postgree, i need to rename with targeted user PG, before using command created table.