在Doctrine2中手动添加新列不起作用

时间:2013-10-22 22:59:09

标签: doctrine-orm

我继承了一个带有doctrine2的zend框架代码。

我试图手动添加新列无效。

1)我在db中创建last_viewed列,这是dateTime格式。

2)我在实体文件中添加了

/**
 * @var datetime $lastViewed
 */
protected $last_viewed;

/**
 * Set lastViewed
 *
 * @param datetime $lastViewed
 */
public function setlastViewed($lastViewed) {
    $this->last_viewed = $last_viewed;
}

/**
 * Get lastViewed
 *
 * @return datetime
 */
public function gelastViewed() {
    return $this->last_viewed;
} 

3)更新了YML文件

last_viewed:
  type: datetime 

但是当我尝试通过

进行检索时
$user->gelastViewed()

我得到一个空值。

同样,当生成实体代理时,我没有在函数“__sleep”中看到列名,其他所有列都在那里。

有关如何手动添加此内容的任何建议。

1 个答案:

答案 0 :(得分:0)

原来缓存是罪魁祸首。重新启动Memcache,现在可以使用!!!