3

谁能告诉我我的代码有什么问题。

在 PHP 5.3 MySQL 5.5 中使用 Doctrine 2

我对名为 IsDefault 的 BIT 字段的 YAML 映射,如果我希望应用程序中的值为真或假,则该字段的值为 1 或 0:

  IsDefault:
    type: boolean
    nullable: false

生成的实体是:

/**
* @var boolean $IsDefault
*/
private $IsDefault;


/**
 * Set IsDefault
 *
 * @param boolean $isDefault
 * @return Model
 */
public function setIsDefault($isDefault)
{
    $this->IsDefault = $isDefault;
    return $this;
}

/**
 * Get IsDefault
 *
 * @return boolean 
 */
public function getIsDefault()
{
    return $this->IsDefault;
}

不幸的是,在我的应用程序中访问数据时,每一行都返回 IsDefault 为 TRUE。有谁知道为什么?

4

1 回答 1

2

我有同样的问题,我换成Bit(1)并且TINYINT(1)运行良好。

于 2013-05-28T15:26:44.843 回答