It looks like an easy task, but I can't get it done:
How do I define a column to be UNSIGNED ZEROFILL with Doctrine2?
I can't find any information about it in the docs.
Thx for any help!
Do you need it on database level or is it required only by the application? You could append zeros on the application level:
class MyEntity {
public function getSomeColumn() {
return sprintf('%05d', $this->someColumn); // or str_pad(...)
}
}
However if you really need it on database level then you'll have to annotate the column as a string: @Column(type="string", columnDefinition="UNSIGNED INTEGER(5) ZEROFILL")
The good syntax is :
@Column(type="integer", columnDefinition="INT(5) UNSIGNED ZEROFILL")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With