我在网上搜索了很长时间,但我不明白我的错误。 你能帮帮我吗?
我在Symfony 3.4上
错误:
(1/1) RuntimeException
The autoloader expected class "AppBundle\Controller\MessagingController" to be defined in file "/home/thomas/Documents/Projects/ludiproject_api/vendor/composer/../../src/AppBundle/Controller/MessagingController.php".
The file was found but the class was not in it, the class name or namespace probably has a typo.
这是我的实体:
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* AppBundle\Entity\Messaging
*
* @ORM\Table(name="messaging")
* @ORM\Entity(repositoryClass="AppBundle\Repository\MessagingRepository")
*/
class Messaging
{
这是我的控制器:
namespace AppBundle\Controller;
use AppBundle\Entity\Messaging;
use DateTime;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use FOS\RestBundle\Controller\Annotations as Rest;
class MessagingController extends Controller
{
这是我的资料库:
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
class MessagingRepository extends EntityRepository
{
答案 0 :(得分:0)
我找到了它!
需要添加&#34; repository-class =&#34; AppBundle \ Repository \ MessagingRepository&#34;在Messaging.orm.xml中。
<entity name="AppBundle\Entity\Messaging" table="messaging" repository-class="AppBundle\Repository\MessagingRepository">