小编jed*_*i58的帖子

Doctrine2 ORM - 无法安排插入的托管+脏实体 X

我有以下课程(仅显示部分以减少阅读量)

class Page {
    /**
     * @ORM\Column(type="string", unique=true, nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="UUID")
     * @var string
     */
    protected $id;
    /**
     * @ORM\OneToMany(targetEntity="Url", mappedBy="content")
     * @var Url[]
     */
    protected $urls;

    public function __construct()
    {
        $this->urls = new ArrayCollection();
    }
}
Run Code Online (Sandbox Code Playgroud)

和:

class Url
{
    /**
     * @ORM\Id @ORM\Column(type="string", unique=true, nullable=false)
     * @ORM\GeneratedValue(strategy="UUID")
     * @var string The unique identifier for the Url
     */
    protected $id;
    /**
     * @ORM\ManyToOne(targetEntity="Page", inversedBy="urls", cascade={"persist", "merge"})
     * @ORM\JoinColumn(name="content_id", referencedColumnName="id")
     * @var int The UUID of the content …
Run Code Online (Sandbox Code Playgroud)

php orm doctrine-orm

6
推荐指数
1
解决办法
6189
查看次数

标签 统计

doctrine-orm ×1

orm ×1

php ×1