I have a legacy application which I am slowly converting to composer, and am writing a new database layer for. This database layer is PSR-0 compatible. The application is split into back and front end, and I am writing common classes for the DB layer so it is more DRY.
In my composer.json for the front end project I have this:
"autoload": {
"psr-0": {
"CompanyName": "_classes/"
}
}
where the CompanyName folder in _classes is in fact a symlink to the analogous folder in the back end project.
This causes the autoloading to fail.
It worked perfectly when it was
"autoload": {
"psr-0": {
"CompanyName": "../otherProject/_classes/"
}
}
but failed when put a symlink in this projects _classes folder.
I need the symlink to work because i do not want to hard code the other projects web folder name into composer.json, as I now have testing versions of both which have different folder names.
The problem was that my symbolic link was relative, which caused it not to work properly. I recreated the link using full paths:
ln -sf /web/otherProject/_classes/CompanyName /web/project/_classes/CompanyName
and now there is no problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.