DragonByte Tech
Well-known member
- Affected version
- 2.0.2
Related to my question here: https://xenforo.com/community/threa...ion-phrases-on-uninstall.143376/#post-1226145
I'm testing an importer, and after receiving an error that a phrase already existed when importing content that uses MasterTitle, I thought I'd bypass by passing the "silent" flag like so:
That shifted the error message:
Fix:
Change the relevant lines in AbstractData to
I'm testing an importer, and after receiving an error that a phrase already existed when importing content that uses MasterTitle, I thought I'd bypass by passing the "silent" flag like so:
PHP:
$this->insertMasterPhrase('dbtech_ecommerce_discount_title.' . $newId, $this->title ?: '', [], true);
That shifted the error message:
LogicException: Cannot detach an entity without a valid primary key in src\XF\Mvc\Entity\Manager.php at line 799
- XF\Mvc\Entity\Manager->detachEntity() insrc\XF\Import\Data\AbstractData.php at line 236
- XF\Import\Data\AbstractData->insertMasterPhrase() in C:\git\dbtech-ecommerce\ecommerce\upload\src\addons\DBTech\eCommerce\Import\Data\Discount.php at line 67
- DBTech\eCommerce\Import\Data\Discount->postSave() insrc\XF\Import\Data\AbstractData.php at line 135
- XF\Import\Data\AbstractData->save() in C:\git\dbtech-ecommerce\ecommerce\upload\src\addons\DBTech\eCommerce\Import\Importer\vBeCommerce.php at line 709
- DBTech\eCommerce\Import\Importer\vBeCommerce->stepDiscounts()in src\XF\Import\Runner.php at line 160
- XF\Import\Runner->runStep() in src\XF\Import\Runner.php at line 74
- XF\Import\Runner->run() in src\XF\Admin\Controller\Import.php at line232
- XF\Admin\Controller\Import->actionRun() in src\XF\Mvc\Dispatcher.phpat line 249
- XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line88
- XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line41
- XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1889
- XF\App->run() in src\XF.php at line 328
- XF::runApp() in admin.php at line 13
Fix:
Change the relevant lines in AbstractData to
PHP:
if ($phrase->save($silent ? false : true, false))
{
$this->dataManager->em()->detachEntity($phrase);
}[/php]
Fillip