Can I map a remote folder|path without include in the project download/upload during sync? Follow
Hi there, I work almost all the time with remote projects so this is how I setup them (step by step):
- Select "Create new project from existing files"
- Select "Web server is on remote host, files are accesible via FTP/SFTP/FTPS"
- Setup name and path in local PC
- Select a predefined SFTP server
- Set project root (top as you may notice) and excludes
- Setup for download but exclude from indexing "vendor"
- Leave blank this step because that URL shown there is the root for VH so no need additional files or path
That's how I am setting up a remote project. This has worked for me until now but also it's giving me some headaches. Why?
- If I download the vendor folder but exclude from indexing (which takes a large ammount of time sometimes) then my application won't recognize (it says undefined namespace xxxxx as shown in red on the pic below) any internal classes from Symfony and any other bundle I was using on my project setup by composer.json file.
- In the other side if I download the vendor folder and allow it to index that fix the issue previous mentioned but create a new one, any time I run composer update on the server I need to synchronize all again and sometimes I got unnecesary files on vendor folder (because they was deleted from previous bundles releases and IDE set them to upload to remote folder) and other times I got files overwrited even deleted (for the same cause)
I have seen this in my project setup but don't know how to get this done:
So there is a safety way by mapping on remote side but without need to sync all the time the vendor folder? Which is the best practice for this in Symfony projects?
Please sign in to leave a comment.
It's a interesting question.
1) If that Wizard (creating new project from existing remote files) creates some issues/limits your options -- just do not use it and do it manually:
It's a few more manual steps .. but greater flexibility.
Or you can just use your FileZilla/whatever to download your project locally beforehand (so, once again, you download only needed files) and then create new project from those local files. Once done -- finish setting it up later (Deployment etc).
2) You need to have "vendor" folder downloaded and not excluded. I mean -- you may exclude it .. but then add it back via "Languages & Frameworks | PHP | Include Paths" so IDE can still index them and offer in code completion.
If you use Composer integration ... IDE will do that automatically: it will exclude individual packages from "vendor" (e.g. "vendor/phpunit/phpunit") and then will re-add it back via "Include Paths" -- basically the same but on individual package level rather than global "vendor" exclusion (you can then add some other files into vendor folder that are not managed by Composer).
>any time I run composer update on the server I need to synchronize all again and sometimes I got unnecesary files on vendor folder (because they was deleted from previous bundles releases and IDE set them to upload to remote folder) and other times I got files overwrited even deleted (for the same cause)
If you do not use Composer locally at all (for this project) and always relying on remote changes -- you may then Sync (Deployment | Sync with Deployed to...) on "vendor" folder separately and then use "Set Mirror to Left" on Sync Diff screen -- so it will copy from remote to local and delete unneeded local files.
P.S. Your last screenshot -- I do not think that you need to enter path to the same folder twice (both local and remote) -- AFAIK only local OR remote should be enough.