相关疑难解决方法(0)

告诉原则一个字段可以为空

我必须在学说实体的注释中输入什么?

其实是这样的...

/**
 * @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

但是代码是什么?

php entity doctrine symfony

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

标签 统计

doctrine ×1

entity ×1

php ×1

symfony ×1