First off, thanks for a great package!
After some hassle, I've got the facades and Eloquent/Builder stuff working like a charm.
But I'm struggling a bit now with the Model helpers. I'd prefer them in the separate _ide_helper_models.php. But if I do so, PhpStorm finds both the original Model and the generated helper. How do I prevent that?
Write them to the actual models, using the write flag (or should suggest that by default?)
Or why do you need them seperate?
It seemed a bit cleaner to have it in a separate file. And not clutter up the Model files.
Also, it's really easy to remove the file and regenerate. Just to be sure that it doesn't fail on existing methods or custom stuff. (I encountered one case where an existing method changed in parameters but the helper wasn't updated accordingly)
I don't know if it makes any difference, but I'm using Lumen 5.3.
You can also use the refresh (-R) option to reset.
Yes, but that removes custom comments.
How is the separate file option supposed to work, regarding the multiple definitions?
+1
Small annoyance, but would be great to find a solution for this.
+1 for this. Models would look much cleaner.
+1
+1
I agree that being able to use the separate model meta file is much better than adding the extra meta to the models. My team and I found having the meta in the models to be a little frustrating when they cause conflicts in version control and over bloated our pull request. The only solution I have found to make this usable as an external file is to disable the check for the duplicate declarations. However, this is the head in the sand approach and I don't like that either.
To turn off this message go to:
Settings -> Editor -> Inspections -> PHP -> Undefined -> Undefined class
Then:
Uncheck Option -> [] Don't report multiple class declaration potential problems
@valeryan But actually uncheck that option will prevent us from knowledge about actual multiple class declaration potential problems
@tucq88 yes, I believe I said this is like sticking your head in the sand. I don't like it but it's the only way I can use this tool right now until someone figures out how to get phpstorm to understand that these files are just providing meta about models.
Initially, I had a hard time of "bloating" the models, but I really enjoy it now. It's something you just have to get used to. Plus, all editors let you fold the comments as well
Anyone managed to resolve this?
This is someting that should be fixed on the IDE side as its the IDE displaying the annoyance and there is little ide-helper can do to avoid that, its just how code inspection works.
It should be possible to create a custom scope that excludes the _ide_helper_models.php and _ide_helper files. Then have that scope used for the inspection causing the warnings but it doesn't seem to work for me.
Any update to this? I can reproduce this on the latest version of Phpstorm.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.
Most helpful comment
@valeryan But actually uncheck that option will prevent us from knowledge about actual
multiple class declaration potential problems