Can I map a remote folder|path without include in the project download/upload during sync?

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"


1.png

  • Select "Web server is on remote host, files are accesible via FTP/SFTP/FTPS"

2.png

  • Setup name and path in local PC
3.png
  • Select a predefined SFTP server
4.png
  • Set project root (top as you may notice) and excludes
5-exclude.png
  • Setup for download but exclude from indexing "vendor"
6-exclude-indexing.png
  • Leave blank this step because that URL shown there is the root for VH so no need additional files or path
7.png

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.
8.png
  • 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:
9.png


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?
1
2 comments

It's a interesting question.

0

Hi there,

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:

  • Create new empty local project
  • Go to Settings/Preferences and configure Deployment entry
  • Use "Browse Remote Host" side panel to browse and download any files/folders that you need

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)

I say:

  • Do not sync "vendor" folder at all -- add its local path into "Excluded paths" tab in Deployment entry.
  • Run "composer update" in both locations: locally and remotely (so you have the same packages installed).

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.

0

Please sign in to leave a comment.