| @@ -1,13 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Mgleis\DiskUsageInsights\Domain; |
| 4 | 4 | |
| 5 | +use PDO; | |
| 6 | + | |
| 5 | 7 | class FileEntryRepository { |
| 6 | 8 | |
| 7 | - private \PDO $db; | |
| 9 | + private PDO $db; | |
| 8 | 10 | |
| 9 | - public function __construct(\PDO $db) { | |
| 11 | + public function __construct(PDO $db) { | |
| 10 | 12 | $this->db = $db; |
| 11 | 13 | $this->initializeDatabase(); |
| 12 | 14 | } |
| 13 | 15 | |
| @@ -68,9 +70,9 @@ | ||
| 68 | 70 | SELECT * FROM fileentries WHERE id =:id |
| 69 | 71 | "); |
| 70 | 72 | $stmt->bindValue(':id', $id); |
| 71 | 73 | $stmt->execute(); |
| 72 | - $result = $stmt->fetch(\PDO::FETCH_ASSOC); | |
| 74 | + $result = $stmt->fetch(PDO::FETCH_ASSOC); | |
| 73 | 75 | if ($result === false) { |
| 74 | 76 | throw new \Exception(sprintf("No file entry with id %s found.", esc_html($id))); |
| 75 | 77 | } |
| 76 | 78 | |
| @@ -99,9 +101,9 @@ | ||
| 99 | 101 | "); |
| 100 | 102 | $stmt->bindValue(':parent_id', $parentId); |
| 101 | 103 | $stmt->bindValue(':name', $part); |
| 102 | 104 | $stmt->execute(); |
| 103 | - $result = $stmt->fetch(\PDO::FETCH_ASSOC); | |
| 105 | + $result = $stmt->fetch(PDO::FETCH_ASSOC); | |
| 104 | 106 | if ($result === false) { |
| 105 | 107 | throw new \Exception(sprintf("Error finding %s", esc_html($relativeFilename))); |
| 106 | 108 | } |
| 107 | 109 | $parentId = $result['id']; |
| @@ -156,9 +158,9 @@ | ||
| 156 | 158 | $stmt = $this->db->prepare(" |
| 157 | 159 | SELECT * FROM fileentries WHERE type in ($types) LIMIT $count OFFSET $skip |
| 158 | 160 | "); |
| 159 | 161 | $stmt->execute(); |
| 160 | - $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); | |
| 162 | + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); | |
| 161 | 163 | |
| 162 | 164 | $results = []; |
| 163 | 165 | foreach ($rows as $row) { |
| 164 | 166 | $entry = new FileEntry(); |