\XF\Import\Data\AbstractEntityData
if you need actual entities.<?php
namespace XF\Import\Data;
class Admin extends AbstractEntityData
{
public function getImportType()
{
return 'admin';
}
public function getEntityShortName()
{
return 'XF:Admin';
}
}
AbstractEntityData
is bugged beyond belief:AbstractEntityData
like so:<?php
namespace Your\Namespace\Import\Data;
use XF\Import\Data\AbstractEntityData;
abstract class AbstractEntityDataFixed extends AbstractEntityData
{
/**
* @param $oldId
*
* @return null|void
*/
protected function preSave($oldId)
{
$entity = $this->entity;
$primaryKey = $this->primaryKey;
if (!$entity->isChanged($primaryKey))
{
if ($this->retainIds() && $oldId !== false)
{
$entity->set($primaryKey, $oldId, ['forceSet' => true]);
}
}
}
/**
* @param $oldId
*
* @return string|null
* @throws \XF\PrintableException
*/
protected function write($oldId)
{
$this->entity->save();
return $this->entity->getIdentifier();
}
}
XF:LikedContent
entity only exists as a compatibility layer between XF 2.0 and XF 2.1 code. The columnAliases
feature was added so that if you try to read data then it doesn't catastrophically fail.Any chance that the time is right, now?!We'll simply release an XF 2.1 compatible version of XFI when the time is right which will use the ReactionContent handler instead of LikedContent.
src/addons/XFI/Import/Importer/XenForo2.php
.'like_date'
'like_date' => 'reaction_date'
$import->like_user_id = $likeUserId;
$import->reaction_user_id = $likeUserId;
src/addons/XFI/Import/Importer/vBulletin.php
.'like_user_id' => $likeUserId,
'like_date' => $reputation['dateline'],
'reaction_user_id' => $likeUserId,
'reaction_date' => $reputation['dateline'],
There's actually only a couple of changes required in the code to make it work right now.
You need to edit the filesrc/addons/XFI/Import/Importer/XenForo2.php
.
Find:
PHP:'like_date'
Replace with:
PHP:'like_date' => 'reaction_date'
'like_date' => 'reaction_date'
'reaction_date'
'reaction_date'
'like_date' => 'reaction_date'
XenForo21
importer. So if you're importing from XF 2.0 then you will use XenForo2
as you do now, but if you're importing from XF 2.1 then you will use XenForo21
. The key differences are the XenForo21
importer handles importing reactions (rather than just likes) and bookmarks.XenForo2
file And/or edit the file:src/addons/XFI/Import/Importer/vBulletin.php
.
Find:
Replace with:PHP:'like_user_id' => $likeUserId, 'like_date' => $reputation['dateline'],
PHP:'reaction_user_id' => $likeUserId, 'reaction_date' => $reputation['dateline'],
We use essential cookies to make this site work, and optional cookies to enhance your experience.