小编use*_*227的帖子

如何在prePersist函数中取消保存实体

我有一个问题:在一个过程中,我想取消在prePersit函数中保存实体:

/**
 * @ORM\PrePersist
 */
public function setTranslationsValue2()
{
    if((null===$this->getContent())or($this->getContent()==''))
    {
        //wanna stop saving this item???
       return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

在上面的函数中,我不想再保存这个实体,并且不想停止我的进程(该进程仍然保存另一个s)

symfony doctrine-orm

10
推荐指数
1
解决办法
5749
查看次数

标签 统计

doctrine-orm ×1

symfony ×1