/** * drop instance * * @param ConfigEntity $config 현재 설정 되어 있는 config * @param int $fetchCount fetch count * @return void */ public function remove(ConfigEntity $config, $fetchCount = 10) { $this->repo->connection()->beginTransaction(); $this->repo->dropDivisionTable($config); $this->configHandler->remove($config); // division table 은 drop 했으므로 처리하지 않는다. $config->set('division', false); while ($docs = $this->repo->fetch(['instanceId' => $config->get('instanceId')], null, $config, $fetchCount)) { foreach ($docs as $doc) { $this->repo->delete(new DocumentEntity($doc), $config); } } $this->repo->connection()->commit(); }
/** * delete document * * @param DocumentEntity $doc document entity * @return int */ public function remove(DocumentEntity $doc) { $config = $this->configHandler->get($doc->instanceId); if ($config === null) { $config = $this->configHandler->getDefault(); } $this->removeCache($doc); return $this->repo->delete($doc, $config); }