Rigel Kentaurus
Well-known member
The current _copyPost method (line ~1539 Model/Post.php) instead of using the DataWriter directly does a $db->_insert() call.
While I assume this is in purpose, add-ons can unintentionally break the functionality, which happened to me. I have an overloaded function on an Add-On that looks like this:
The short story here is that ...
While this is not a bug in the out of the box package, and it is caused by an Add-On, it does mean that every Add-On that extends the preparePostJoinOptions now or in the future will end up breaking the copy and move functionality unless the mod author explicitly compensates for that.
While I assume this is in purpose, add-ons can unintentionally break the functionality, which happened to me. I have an overloaded function on an Add-On that looks like this:
Code:
public function preparePostJoinOptions(array $fetchOptions)
{
$joinOptions = parent::preparePostJoinOptions($fetchOptions);
$joinOptions['joinTables'] .= "
LEFT JOIN xfa_blog ON xfa_blog.user_id = post.user_id
";
return $joinOptions;
}
The short story here is that ...
- When the posts are loaded, it uses the prepare() methods in the model, and adds additional columns
- When the new post is saved back, it just tries to write everything in the array, which includes several columns that will not exist in the xf_post table since they were fetched with a join
While this is not a bug in the out of the box package, and it is caused by an Add-On, it does mean that every Add-On that extends the preparePostJoinOptions now or in the future will end up breaking the copy and move functionality unless the mod author explicitly compensates for that.