Open Koc opened 7 years ago
@enriquepiatti please, please, please, fix this :)
@Koc what is your proposal? if the classes are created when Magento is executed, is not easier just to run Magento and let PhpStorm find the class after that?
Some project created as remote project by sftp. And we need each time make sync for downloading factory classes. And newly just created classes haven't factories unntil they will requested - so no any autocomplete here. Magento has long namespaces and easy make mistake and type wrong class or ns.
OK, but what is the proposal for that then? PhpStorm need the class, the only solution I can think is to create a fake class somewhere, but then it could confuse the code when you do the sync with the real class, I will think about it a bit more... but you don't have a local Magento2 in your environment? to test your code? it should be enough to create the classes just executing your local Magento
but you don't have a local Magento2 in your environment? to test your code?
I am testing my code on virtual machine and it configured as sftp https://www.jetbrains.com/help/phpstorm/creating-a-remote-server-configuration.html
The other problem that Magento generates too many Interceptor
s classes. And this classes should be ignored. But they are located not in separated folders, between factories. So better way just ignore full var dir and generate fake factory classes by plugin.
I don't see very clear this solution, or even if it's a good idea, normally you have a local environment to test, because is faster too, and you can break it without messing other things, and also because you can debug it, and when you debug the code you will probably need those interceptors and factory, the real ones. I guess you could sync in both ways your SFTP, so your local project will download the files from var/generation and PhpStorm will understand the code better
Magento 2 not supports Windows oficially http://devdocs.magento.com/guides/v2.1/install-gde/system-requirements-tech.html . I am working on Windows with Ubuntu launched on Virtualbox.
Also on Linux it runs faster.
Yes but you can sync your code in both ways anyway with SFTP, just download the var/generation folder from your Magento2 and PhpStorm will recognize and use the real classes
How can we stop this madness with intercepror classes and exclude they from any search by default?
Not sure if that's possible. But you could just search inside app/code or inside vendor folders. Or I guess you could just ignore those results, they are easy to identify. But let me know if this is becoming a problem for some other reason, or is slowing you somehow
EDIT: actually, I think you could also create a custom "scope" and search on that always
@Koc just mark var
directory as excluded.
@orlangur in this case there is no autocomplete of factory classes and I've got a tons of undefined factory classes. And no autocomplete of $factory->create()->...
True, just noticed all but var/generation
is excluded in my setup, looks like just always ignored them during search.
CategoryFactory
andCollectionFactory
marks as undefined because they are generated at runtime. Magicento can detect this kind of classes and create they on the fly and autocompletes it.