_init('mageplaza_blog_comment', 'comment_id'); } /** * @param AbstractModel $object * * @return $this */ protected function _beforeSave(AbstractModel $object) { if (is_array($object->getStoreIds())) { $object->setStoreIds(implode(',', $object->getStoreIds())); } return $this; } /** * Check is imported category * * @param $importSource * @param $oldId * * @return string * @throws LocalizedException */ public function isImported($importSource, $oldId) { $adapter = $this->getConnection(); $select = $adapter->select() ->from($this->getMainTable(), 'comment_id') ->where('import_source = :import_source'); $binds = ['import_source' => $importSource . '-' . $oldId]; return $adapter->fetchOne($select, $binds); } /** * @param $importType * * @throws LocalizedException */ public function deleteImportItems($importType) { $adapter = $this->getConnection(); $adapter->delete($this->getMainTable(), "`import_source` LIKE '" . $importType . "%'"); } }