我必须在学说实体的注释中输入什么?
其实是这样的...
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\Length(
* min=3,
* max=255,
* minMessage="The name is too short.",
* maxMessage="The name is too long.",
* groups={"Registration", "Profile"}
* )
*/
protected $name;
Run Code Online (Sandbox Code Playgroud)
我必须告诉教义类似的东西canBeNull=true。否则我总是会收到这个错误SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null
但是代码是什么?