/** * @return $successfulArchive */ public function archive() : bool { if ($this->isArchivedTable()) { // @todo: Replace pseudo code $archived = !$this->sql->create($this->getArchivedTablename()); if ($archived) { $archived = $archived && $this->delete(); if ($archived) { $duplicate = false; } else { $duplicate = !$this->sql->delete($this->getArchivedTablename()); } } } else { $archived = false; } if ($success) { $this->record('arc_suc', RecordService::INFO, 'Archived entity successfully.', $this->data); } elseif ($duplicate) { $this->record('arc_err', RecordService::ERROR, 'Archiving ended up with duplicate data sets. ', $this->data); } else { $this->record('arc_fai', RecordService::ERROR, 'Archiving failed.', $this->data); } return (bool) $success; }