Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony2>;MappingException:类…\Entity\User不存在_Php_Symfony - Fatal编程技术网

Php Symfony2>;MappingException:类…\Entity\User不存在

Php Symfony2>;MappingException:类…\Entity\User不存在,php,symfony,Php,Symfony,我正试图从数据库中获得我的用户身份验证。我已经按照食谱中的说明建立了一个用户实体。我的捆绑包在appKernel中注册,我以前使用过该捆绑包。唯一更改的是新的Entity\User.php和security.yml中的更改。我确信这是一件愚蠢的事情,但就我的一生而言,我不知道我做错了什么。当我执行cache:clear时,我得到以下结果: 浏览app_dev.php时: 从app\src\myfrequeler\PortalBundle\Entity\User.php中提取 <?php

我正试图从数据库中获得我的用户身份验证。我已经按照食谱中的说明建立了一个用户实体。我的捆绑包在appKernel中注册,我以前使用过该捆绑包。唯一更改的是新的Entity\User.php和security.yml中的更改。我确信这是一件愚蠢的事情,但就我的一生而言,我不知道我做错了什么。当我执行cache:clear时,我得到以下结果:

浏览app_dev.php时:

从app\src\myfrequeler\PortalBundle\Entity\User.php中提取

<?php
namespace MyFreelancer\PortalBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use JMS\Serializer\Annotation as Ser;
use Gedmo\Mapping\Annotation as Gedmo;

use Symfony\Component\Security\Core\User\Role;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;

/**
 * User
 *
 * @ORM\Entity
 * @ORM\Table(name="users")
 * @Ser\ExclusionPolicy("all")
 */
class User implements AdvancedUserInterface, \Serializable
{
    /**
    * @var integer
    *
    * @ORM\Column(name="id", type="integer")
    * @ORM\Id
    * @ORM\GeneratedValue(strategy="AUTO")
    * @Ser\Expose
    */
    private $id;
...

如您所见,实体存在于正确的文件结构中,名称空间在实体文件中定义,类被定义为实体,捆绑包被注册。我不知道我遗漏了什么。

根据jperovic的评论,这只是从security.yml中删除“,”的一个案例。我没有意识到这是一个非常愚蠢的错误。

根据jperovic的评论,这只是将“,”从security.yml中删除的一个案例。真是一个愚蠢的错误,我只是没有意识到。

删除config
行末尾的
。呃,我知道这很愚蠢。非常感谢。删除config
行末尾的
。啊,我知道这很愚蠢。非常感谢你。
    providers:
    main:
        entity:
            class: MyFreelancer\PortalBundle\Entity\User,
            property: username