swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

[db]当数据库字段默认值为''是,php bin/swoft entity:create生成实体有问题 #186

Closed uhonliu closed 6 years ago

uhonliu commented 6 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 1.0.0
Swoole version 2.1.12
PHP version 7.1.14
Runtime environment CentOS 7

Details

当数据库字段默认值为''是,php bin/swoft entity:create生成实体字段有问题.


   /**
     * @var int $id 主键ID
     * @Id()
     * @Column(name="id", type=Types::INT)
     */
    private $id = '';

    /**
     * @var string $mobile 手机号
     * @Column(name="mobile", type=Types::STRING, length=11)
     * @Required()
     */
    private $mobile = '''';

    /**
     * @var string $email 邮箱
     * @Column(name="email", type=Types::STRING, length=50)
     * @Required()
     */
    private $email = '''';

    /**
     * @var string $auth_code 验证码
     * @Column(name="auth_code", type=Types::STRING, length=8)
     * @Required()
     */
    private $auth_code = '''';

    /**
     * @var string $auth_type 行为:注册,找回密码等
     * @Column(name="auth_type", type=Types::STRING, length=30)
     * @Required()
     */
    private $auth_type = '''';
stelin commented 6 years ago

已修复,db组件请更新至v1.1.4