2012-09-30 25 views
2

我的捆綁中有2個實體通過simplethings/entity-audit進行了審覈。 我想添加一個字段到REVISIONS表調用「原因」。每次用戶更新或刪除一個實體時,他/她都需要通過表單來指定這樣做的原因(爲什麼更新/刪除),並且這個原因應該與實體修訂相關聯。Symfony2 entityaudit:在修訂表上添加字段

你們會怎麼做?我沒有太多的OOP經驗。

非常感謝您提前。

回答

0

添加字段,您需要添加在你的數據庫像「IP」下次你改變你的包中的文件「logRevisionsListener.php」

private function getRevisionId() 
    { 
     if ($this->revisionId === null) { 
      $this->conn->insert($this->config->getRevisionTableName(), array(
       'timestamp'  => date_create('now'), 
       'username'  => $this->config->getCurrentUsername(), 
       'ip'  => $this->config->getCurrentUsername(),(not correct just for test it give me the user name) 
      ), array(
       Type::DATETIME, 
       Type::STRING, 
       Type::STRING 
      )); 
. 
. 
} 

我加入這裏的IP領域領域,改變你的Revision.php通過添加您的領域與吸氣劑方法文件

相關問題