private function saveStoreRelation(\Magento\Framework\Model\AbstractModel $object)
{
$storeIds = $object->getStoreIds();
if (is_array($storeIds) && count($storeIds) > 0) {
if (in_array(0, $storeIds)) {
$storeIds = [0];
}
$storeLinks = [];
$deleteCondition = [ThesaurusInterface::THESAURUS_ID . " = ?" => $object->getThesaurusId()];
foreach ($storeIds as $key => $storeId) {
$storeLinks[] = [ThesaurusInterface::THESAURUS_ID => (int) $object->getThesaurusId(), ThesaurusInterface::STORE_ID => (int) $storeId];
$storeIds[$key] = (int) $storeId;
}
$deleteCondition[ThesaurusInterface::STORE_ID . " NOT IN (?)"] = array_keys($storeIds);
$this->getConnection()->delete($this->getTable(ThesaurusInterface::STORE_TABLE_NAME), $deleteCondition);
$this->getConnection()->insertOnDuplicate($this->getTable(ThesaurusInterface::STORE_TABLE_NAME), $storeLinks, array_keys(current($storeLinks)));
}
}