private function getFilePath(File $file) { $storagePath = __DIR__ . '/../../files/' . date('Y/m/d', strtotime($file->getCreatedAt())); if (!is_dir($storagePath)) { mkdir($storagePath, 0777, true); } return $storagePath . '/' . $file->getId(); }
public function delete(File $file) { $statement = $this->pdo->prepare("DELETE FROM file WHERE id=:id"); $statement->execute(['id' => $file->getId()]); }