试图从命名空间“ Symfony \ Bundle \ FrameworkBundle \ Tests \ Fixtures \ Validation”中加载接口“ NotExistingInterface”。 您是否忘记了另一个名称空间的“使用”语句?无法理解此错误
Symfony \ Component \ Debug \ Exception \ ClassNotFoundException 在\ vendor / symfony / framework-bundle / Tests / Fixtures / Validation / Article.php(第5行)中
<?php
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
class Article implements NotExistingInterface
{
public $category;
}
我不知道错误。请帮忙。
答案 0 :(得分:0)
您的代码应类似于:
<?php
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\NotExistingInterface;
class Article implements NotExistingInterface
{
public $category;
}
答案 1 :(得分:0)
您的代码中可能有一个名为Article的类,并且在某些代码中使用它时,却忘记了它的使用声明。
我遇到了同样的问题,这就是为什么我在这里=)。
事实证明,我没有在其他代码中放置我的Article类的use语句,并且在执行时,它必须决定使用FrameworkBundle测试中的Article类。可能有些自动加载/自动装配的怪异之处。
答案 2 :(得分:0)
我只是遇到了同样的问题。
在控制器中,我需要我的Article实体,IDE建议我导入该类,然后单击了错误的类。
检查您的进口(使用)
您可能有一个...
use Symfony\FrameworkBundle\Tests\Fixtures\Validation\Article;
代替
use App\Entity\Article;