复制/归档数据库中的对象 - Symfony
如果我添加和编辑新闻,我想制作副本。
class News extends BaseNews
{
public function postSave(){
$copy = new CopyNews($this);
$copy->save();
}
public function save(Doctrine_Connection $conn = null)
{
return parent::save($conn);
}
}
但我有错误:
严格标准:News::postSave() 声明应兼容 与 Doctrine_Record::postSave() 中的 ...
我怎样才能做到这一点?
i would like make copy if i add and edit News.
class News extends BaseNews
{
public function postSave(){
$copy = new CopyNews($this);
$copy->save();
}
public function save(Doctrine_Connection $conn = null)
{
return parent::save($conn);
}
}
but i have error:
Strict Standards: Declaration of News::postSave() should be compatible
with that of Doctrine_Record::postSave() in ...
How can i make this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所有 pre- 和 post- 方法都接收 $event 作为参数。您应该将该方法重写为
All pre- and post- methods receive $event as a parameter. You should rewrite the method as
您所需要的一切都在教义内
......并且它是文档:
http://www.doctrine-project.org/documentation/manual/1_2/en/component-overview:record:getting-object-copy
All you need is within doctrine
... and it's documentation :
http://www.doctrine-project.org/documentation/manual/1_2/en/component-overview:record:getting-object-copy