如何在doctrine 2中的表中将0值设置为列?它像null一样保存

时间:2013-09-27 15:47:58

标签: doctrine-orm null entity persist

嗨我用表创建了应用程序,其中一列是不能为空的。 当我用0值持续值时。该学说将其作为空值保存到数据库。 我正在尝试在我的代码中保存列sort_id值。 如何将0值保存为0整数值?

这是我的代码

  namespace cms\models\Entities;

  use \cms\Doctrine\ORM\Mapping as ORM; 
  use \cms\Doctrine;
  use \cms\models\Entities; 
  /**
  * @Entity
  * @Table(name="vkladki")
  */
  class Vkladki{
    /**
     * @Id
     * @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    protected $id; 

    /**
     * @Column(type="string", length=255)
     */
    protected $title;

    /**
     * @Column(type="integer")
     */
    protected $cat_id;  

    /**
     * @var integer
     * @Column(type="integer", nullable=false)
     */
    protected $sort_id;  

 public function setSortId( $sort_id){
        $this->sort_id = $sort_id;
    } 

0 个答案:

没有答案