Laravel-ide-helper: Request: Ability to ignore models when generating php docs for models

Created on 10 Oct 2013  路  10Comments  路  Source: barryvdh/laravel-ide-helper

Can a configuration be provided using which some models can be ignored when generating php docs for the models.

My use case is the following:
My application has few models communicating to MongoDB and some to MySQL.
When ide-helper generates the phpdocs, it throws and error

Exception: call_user_func_array() expects parameter 1 to be a valid callback, class 'MongoDB' does not have a method 'getDoctrineDriver'
Could not analyze class Action.

So this just errors out and does not generate the PHP docs.

So if there was a configuration, something like

php artisan ide-helper:models ignore-models:Model1,Model2

we could ignore the required models.

Most helpful comment

Is it possible to get this working setting a mode that ignores database entity schematics but keeps generating phpdocs for scope methods and things like that?
It would be reeeeeally useful.

All 10 comments

You can do the opposite, set which models you do want to get checked.
But I'll see if i can add this feature, or at least some better erorr checking so it continues.

I understand @barryvdh, but it becomes very difficult if there are a lot of models. I actually wanted to generate for all the models but as I said, it errors out for the MongoDB models and doesn;t generate the docs...

Can you also provide as a configuration for the console read that you ask when generating models

Do you want to overwrite the existing model files for '*'? 
Choose no to write to _ide_helper_models.php instead? (Yes/No):

like

php artisan ide-helper:models overwrite:no

both these configurations help when you want to automate using the composer scripts.
i have an .sh script that pull all the git files of other users and then executes the ide-helper. But haven't been able to use the models functionality as of now.

Well, I actually wanted to make 'yes' the default option, but to not break for existing people, I added a suggestion.
The No option didn't really seem useful for me, so there is only a -W (force yes) option. Perhaps I can add a no shortcut also.

I was actually scared to use the -W option, because if I had any custom functions or relationships, was worried if they get overwritten as well, haven't tried this option at all.

cool, will look forward to this. Thanks for considering this..

Okay, added a --nowrite (-N) and --ignore (-I) option.
I looked at catching, but it looks like is actually is catching the Exception, so it should just continue. Strange it doesn't.

The -W option should just overwrite the phpdocs, but it is good to make a backup before trying ;)
It works fine in my projects and makes it a lot easier to update phpdocs.

cool stuff, let me try it now.

Unfortunately, this getDoctrineDriver issue has raised over User model and seems like it is also related to MongoDB package, as I'm using jenssegers/mongodb

Is it possible to get this working setting a mode that ignores database entity schematics but keeps generating phpdocs for scope methods and things like that?
It would be reeeeeally useful.

Is it possible to get this working setting a mode that ignores database entity schematics but keeps generating phpdocs for scope methods and things like that?
It would be reeeeeally useful.

Agreed, It would be nice to have basic phpdocs for mongodb models.
Also, some relationships are supported by jenssegers/mongodb.

Was this page helpful?
0 / 5 - 0 ratings