Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.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
Symfony php bin/console make:当我尝试创建新的_Symfony_Doctrine - Fatal编程技术网

Symfony php bin/console make:当我尝试创建新的

Symfony php bin/console make:当我尝试创建新的,symfony,doctrine,Symfony,Doctrine,我在控制台中创建了一个积垢 php bin/console make:crud Location 它很好用。我去/location/ 单击Createnew,我得到了这个sql错误 执行“选择e0_u.id作为id_0,e0_u.created作为created_1,e0_u.updated作为updated_u,e0_u.id作为updated_u作为updated_u作为id_3,e0_u.type作为type_4,p1_u.name作为name_5,p1_u.email作为em

我在控制台中创建了一个积垢

    php bin/console make:crud Location
它很好用。我去
/location/

单击Createnew,我得到了这个sql错误

执行“选择e0_u.id作为id_0,e0_u.created作为created_1,e0_u.updated作为updated_u,e0_u.id作为updated_u作为updated_u作为id_3,e0_u.type作为type_4,p1_u.name作为name_5,p1_u.email作为email_6,e0_u.created作为created_u作为created_u作为created_u作为created_u作为created_u作为id_u,e0作为eu作为权限id_8,p1.id作为关系,e0_uuuu作为权限关系,p1_u.locations_uid AS locations_uid_u10 FROM people p1_u:SQLSTATE[42S22]:未找到列:字段中的1054未知列“e0_u.id”

那里好像有两张桌子。请帮忙

下面是
位置
类。它包括
。创建人是一个
。我不知道我的映射是否正确,我对
Symfony
非常陌生

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Class Location
 * @package App\Entity
 * @ORM\Entity() 
 * @ORM\Table("locations")
 */
class Location
{

     /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
     protected $id;

    /**
    * @ORM\Column(type="datetime")
    */
    protected $created;

    /**
    * @ORM\Column(type="datetime")
    */
    protected $updated;

    /**
    * @ORM\OneToOne(targetEntity="App\Entity\Person")
    * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
    */
    protected $createdBy;

    /**
    * @ORM\OneToOne(targetEntity="App\Entity\Permission")
    * @ORM\JoinColumn(name="permission_id", referencedColumnName="id")
    */
    protected $permissions;

    /**
    * @ORM\Column(name="updated_by_id")
    * @ORM\OneToOne(targetEntity="App\Entity\Person")
    */
    protected $updatedBy;

    /**
    * @ORM\Column(length=255)
    */
    private $name;

    /**
    * @ORM\OneToOne(targetEntity="Address")
    * @ORM\JoinColumn(name="address_id", referencedColumnName="id")
    */
    private $address;

    /**
    * @ORM\Column(length=255)
    */
    private $geoSpatial;


}
  • 确保同一数据库中没有同名的现有表
  • 确保在创建或更改实体之后更新数据库架构。如果您希望遵循文档,则必须使用迁移,但如果您希望立即进行更改,则可以这样做

警告:请勿在生产环境中使用此命令

这是什么
实体?查询在此表上,而不是
Location

/**
 * @ORM\ManyToOne(targetEntity="App\Entity\Person")
 * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
 */
protected $createdBy;
需要正确映射创建的。我真是个傻瓜


感谢那个注意到“人们从哪里来”的人帮助我,有时候你在自己的代码中看不到东西

created_by_id是一个被我删除的人实体,它可以工作。可能与我的映射有关。您的查询似乎不完整。它以来自人的
结尾<代码>e0
不知从何而来。您应该有一个
JOIN
。错误来自
e0_uu.id
,因为它是
e0_u
的第一个引用,并且它不知道它是什么。
people
Person
实体的表名吗?
/**
 * @ORM\ManyToOne(targetEntity="App\Entity\Person")
 * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
 */
protected $createdBy;