Php Symfony FileLoaderLoadException但类确实存在
我从昨天开始一直在使用Symfony 3,但在自动布线方面遇到了困难 由于某些原因,文件加载器无法在我的类确实存在时找到它 在services.yml中,我有以下内容:Php Symfony FileLoaderLoadException但类确实存在,php,symfony,symfony-3.3,Php,Symfony,Symfony 3.3,我从昨天开始一直在使用Symfony 3,但在自动布线方面遇到了困难 由于某些原因,文件加载器无法在我的类确实存在时找到它 在services.yml中,我有以下内容: services: _defaults: autowire: true autoconfigure: true public: true RideShare\Infrastructure\: resource: '../../src/RideSha
services:
_defaults:
autowire: true
autoconfigure: true
public: true
RideShare\Infrastructure\:
resource: '../../src/RideShare/Infrastructure/*'
在文件夹src/RideShare/Infrastructure/EventStore/doctor
中,有文件DoctrineEventStore.php
,其中包含以下内容:
<?php
namespace RideShare\Infrastructure\EventStore\Doctrine;
use ...;
class DoctrineEventStore extends EntityRepository implements EventStore
就我所见,这个声明是正确的,我在stackoverflow或Symfony文档中没有看到类似的问题,我也不知道为什么它会失败
完整代码可在中找到。问题在于EventStore接口的命名空间错误。问题在于EventStore接口的命名空间错误。是否尝试重置php cli opcache?我在CGI模式下运行,没有opcache?是否尝试重置php cli opcache?我在CGI模式下运行,没有opcacheopcache@NiketPathak经过进一步调试后,似乎EventStore的命名空间是错误的(因此DoctrineEventStore实现的接口)@NiketPathak经过进一步调试后,似乎EventStore的命名空间是错误的(因此DoctrineEventStore实现的接口)
Symfony\Component\Config\Exception\FileLoaderLoadException:
Expected to find class "RideShare\Infrastructure\EventStore\Doctrine\DoctrineEventStore" in file "[....]src/RideShare/Infrastructure/EventStore/Doctrine/DoctrineEventStore.php" while importing services from resource
"../../src/RideShare/Infrastructure/*", but it was not found! Check the namespace prefix used with the resource in [...]/app/config/services.yml (which is being imported from "[...]/app/config/config.yml"). in [...]/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php on line 179