Ich habe meine Rollen in der db zu laden:Versuchte Klasse "Rollen" von Namespace AppBundle Repository
AppBundle\Entity\Roles:
type: entity
table: Roles
repositoryClass: AppBundle\Repository\Roles
Leere Klasse für Testzwecke:
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
use AppBundle\Entity\Roles;
class RolesRepository extends \Doctrine\ORM\EntityRepository
{
}
und einfacher Anwendungsfall in meinem Controller :
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use AppBundle\Entity\Roles;
class ClientsController extends CommonController
{
public function newAction(Request $request)
{
// [...]
$role = $this->getDoctrine()
->getRepository('AppBundle:Roles')
->findOneBy(array('role'=>'ROLE_CLIENT'));
// [ ...]
}
}
Und wenn nur habe ich "repositoryClass: \ AppBundle \ Repository \ Rollen" in meiner .orm.yml Datei, ich habe ich t er Fehler:
Attempted to load class "Roles" from namespace "\AppBundle\Repository". Did you forget a "use" statement for another namespace?
Jeder kann mir dabei helfen?