Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Ability to ignore models when generating php docs for models #35

Closed
abishekrsrikaanth opened this issue Oct 10, 2013 · 12 comments

Comments

@abishekrsrikaanth
Copy link

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.

@barryvdh
Copy link
Owner

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.

@abishekrsrikaanth
Copy link
Author

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...

@abishekrsrikaanth
Copy link
Author

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.

@barryvdh
Copy link
Owner

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.

@abishekrsrikaanth
Copy link
Author

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..

barryvdh added a commit that referenced this issue Oct 18, 2013
To write to single file instead, use --nowrite or -N (as mentioned in
#35)
@barryvdh
Copy link
Owner

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.

@abishekrsrikaanth
Copy link
Author

cool stuff, let me try it now.

@vaishnavmhetre
Copy link

vaishnavmhetre commented Jun 12, 2018

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

@RiccardoManzan
Copy link

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.

@amirhs712
Copy link

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.

@MrHaroldA
Copy link

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.

I'm pretty late to the party, but connectionless Eloquent-like models like Jenssegers\Model would fit the Mongo case as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@MrHaroldA @barryvdh @abishekrsrikaanth @vaishnavmhetre @amirhs712 @RiccardoManzan and others