Symfony 在哪里检查类是否已加载?
在HasRoleRepository.php中:Symfony 在哪里检查类是否已加载?,symfony,Symfony,在HasRoleRepository.php中: use \XXX\MyBundle\Model\Role_RT; use \XXX\MyBundle\Model\Role; ... public static function toModelClass($hasRoleArray, $RefGroupeRtArray) { $roles = array(); foreach($hasRoleArray as $hasRole) { $role = $ha
use \XXX\MyBundle\Model\Role_RT;
use \XXX\MyBundle\Model\Role;
...
public static function toModelClass($hasRoleArray, $RefGroupeRtArray) {
$roles = array();
foreach($hasRoleArray as $hasRole) {
$role = $hasRole->getIdRole()->getId() === 1 ? new Role_RT() : new Role();
....
}
我有一个致命错误:错误:在\src\XXX\MyBundle\Repository\HasRoleRepository.php第37行中找不到类'XXX\MyBundle\Model\Role\RT'
Role类没有问题,它只是Role\u RT类
角色和角色\u RT中的名称空间相同:
namespace XXX\MyBundle\Model;
我不明白。这个没有加载。为什么?怎么做
谢谢在类名中使用uu意味着Symfony没有检测到它,这被认为是一种不好的做法(因为它的构建是为了防止不好的做法)。请将模型名称更改为RoleRT,然后重试 我同意
Splendonia
。如果您想使用Symfony(最常见的是Composer),您必须使用PSR-0命名约定
请浏览: