I've added a local development module (separate git repo) to Magento 2 using symbolic links and it was working fine until I hit the PHTML templates. After heavy debugging I found out that the Magento 2 filesystem class (
Magento\Framework\Filesystem\Directory\Read) uses an
isExists() method combined with an
getAbsolutePath() call to see whether the PHTML template exists. However, the
getAbsolutePath() method checks whether the relative path exists within the Magento 2 filesystem and if not, it prepends the Magento 2 root to. it. In my case, the module lives in a separate repo
/git/A while Magento lives in
/site/B and this behaviour checks for the existence of a PHTML template in
In short: PHTML templates that live outside of the Magento 2 root filesystem are not picked up, regardless of the System Configuration setting "Allow Symlinks" being turned on. It seems that setting is working, but only if the source of the symlink is still within the Magento 2 filesystem.
Has anybody else encountered this? What would be the best way to handle development in an external git repo?