swoft
swoft copied to clipboard
实际引用的文件与配置不一致
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| Swoft version | v2.0.7 |
| Swoole version | 4.4.17 |
| PHP version | PHP 7.1.8 |
| Runtime environment | CentOS 6.5 |
Describe the bug
controller中配置
use App\Model\Logic\TaskLogic;
/**
* @Inject()
*
* @var TaskLogic
*/
private $tasklogic;
项目中有两个相同文件(传错地方了):
/swoft/app/Model/Data/TaskLogic;
/swoft/app/Model/Logic/TaskLogic;
这样情况下/swoft/app/Model/Logic/TaskLogic;文件只要存在就可以,无论怎么修改都无效。
Expected behavior 正确调用/swoft/app/Model/Logic/TaskLogic;文件
Screenshots If applicable, add screenshots to help explain your problem.
Details
Describe what you are trying to achieve and what goes wrong.
// paste output here
Provide minimal script to reproduce the issue
Controller
use App\Model\Logic\TaskLogic;
/**
* @Inject()
*
* @var TaskLogic
*/
private $tasklogic;
Logic
namespace App\Model\Logic;
你文件放错了,但是 命名空间都写的一样的吗?
@inhere 是的。文件一样,一个在data一个在logic
先扫描的类,Data 下面的先加载,这样子就始终是用的错误的那个了。
@inhere use App\Model\Logic\TaskLogic; 这个没用么? 还有就是如果一个在/test/logic一个在/logic下启动的时候就会报错。那在data与logic的应该也能优化下报错吧。