Doctrine orm Uniquentity日期时间Symfony4:“;该字段未按条令映射,因此无法验证其唯一性。”;
我正在尝试对datetime字段使用Uniquentity。当我使用字符串字段或电子邮件时,一切都正常。但是对于datetime:“date_one”字段未按条令映射,因此无法验证其唯一性。”Doctrine orm Uniquentity日期时间Symfony4:“;该字段未按条令映射,因此无法验证其唯一性。”;,doctrine-orm,symfony4,Doctrine Orm,Symfony4,我正在尝试对datetime字段使用Uniquentity。当我使用字符串字段或电子邮件时,一切都正常。但是对于datetime:“date_one”字段未按条令映射,因此无法验证其唯一性。” 一个想法?你有没有尝试过dateOne而不是date\u one,作为uniquentity的字段?你有没有尝试过dateOne而不是date\u one,作为uniquentity的字段 (...) use Doctrine\ORM\Mapping as ORM; use Symfony\Compone
一个想法?你有没有尝试过
dateOne
而不是date\u one
,作为uniquentity
的字段?你有没有尝试过dateOne
而不是date\u one
,作为uniquentity
的字段
(...)
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\VisitRepository")
* @UniqueEntity(
* fields={"dateOne"},
* message="Cette date est déjà prise"
* )
*/
(...)
所以,这没关系:
(...)
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\VisitRepository")
* @UniqueEntity(
* fields={"dateOne"},
* message="Cette date est déjà prise"
* )
*/
(...)
使用dateOne时:“从访问t0执行'SELECT t0.id AS id_1,t0.grouptype AS grouptype_2,t0.groupname AS groupname_3,t0.fullname AS fullname_4,(…*)时发生异常:SQLSTATE[42703]:未定义列:7错误:列t0.dateone不存在第1行:…il作为电子邮件,t0.num作为num作为访客,t0.dateone…^提示:也许您是想引用列“t0.date”吧。“我猜
uniquentity
查看的是模型属性而不是列,我自己没有时间检查它。。。看看你的其他评论,它奏效了,这就是我的意思;)使用dateOne时:“从访问t0执行'SELECT t0.id AS id_1,t0.grouptype AS grouptype_2,t0.groupname AS groupname_3,t0.fullname AS fullname_4,(…*)时发生异常:SQLSTATE[42703]:未定义列:7错误:列t0.dateone不存在第1行:…il作为电子邮件,t0.num作为num作为访客,t0.dateone…^提示:也许您是想引用列“t0.date”吧。“我猜uniquentity
查看的是模型属性而不是列,我自己没有时间检查它。。。看看你的其他评论,它奏效了,这就是我的意思;)