繁体   English   中英

Symfony FileLoaderLoadException但类确实存在

[英]Symfony FileLoaderLoadException but class does exist

从昨天开始,我一直在使用Symfony 3,但是在自动接线方面遇到了困难。

由于某种原因,FileLoader在存在时无法找到我的类。

在services.yml中,我有以下内容:

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: true

    RideShare\Infrastructure\:
        resource: '../../src/RideShare/Infrastructure/*'

src/RideShare/Infrastructure/EventStore/Doctrine文件夹中,具有以下内容的文件DoctrineEventStore.php

<?php

namespace RideShare\Infrastructure\EventStore\Doctrine;

use ...;

class DoctrineEventStore extends EntityRepository implements EventStore

但是,当我尝试运行php bin/console ,出现以下异常:

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

对于我看到的该声明是正确的,我在stackoverflow或Symfony文档中都没有看到这样的问题,而且我也不知道为什么它会失败。

完整的代码可以在Github上找到。

问题是EventStore接口的命名空间错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM