在创建实体之后,我在主题中遇到了许多类似于此的错误。不知道为什么使用标签似乎是正确的。使用symfony 6.1。
这是我的模型:
namespace App\Entity;
use App\Repository\MovieRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MovieRepository::class)]
class Movie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
}发布于 2022-06-30 03:29:23
而不是这个
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MovieRepository::class)]
class Movie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;试试看
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
#[Entity(repositoryClass: MovieRepository::class)]
class Movie
{
#[Id, GeneratedValue, Column(type: 'integer')]
private int $id;https://stackoverflow.com/questions/72808800
复制相似问题