$ composer init-proxy
> init-proxy.sh
../../
Runtime cleared
Scanning app ...
Scan app completed, took 195.76692581177 milliseconds.
Scanning vendor ...
Scan vendor completed, took 510.0839138031 milliseconds.
This command does not clear the runtime cache, If you want to delete them, use `vendor/bin/init-proxy.sh` instead.
Proxy class create success.
Finish!
$ composer init-proxy
> init-proxy.sh
../../
Runtime cleared
Scanning app ...
Scan app completed, took 3063.5998249054 milliseconds.
Scanning vendor ...
Scan vendor completed, took 490.39006233215 milliseconds.
This command does not clear the runtime cache, If you want to delete them, use `vendor/bin/init-proxy.sh` instead.
Proxy class create success.
Finish!
解决办法
以下解决办法建立在正确使用 Model 的基础上。比如不在 Model 中使用注解。检测办法是,不排除 Model 目录的情况下生成一下代理缓存,查看是否生成 Model 相关的代理。
所以,我们可以主动修改Hyperf框架的扫描目录,排除掉模型目录。让我们写一段逻辑,修改annotations.php。