summaryrefslogtreecommitdiff
path: root/patched fetchTableColumns.txt
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-20 22:48:20 +0200
committerpolo <ordipolo@gmx.fr>2026-10-20 22:49:21 +0200
commiteeda06c4729a36b7a88c5a413978ec8626c867b0 (patch)
treec8a493ab914e5af873412049b6d38d05ec17af2b /patched fetchTableColumns.txt
parent0161ac4d632af7d45f4fe9d68c1ba3a86f094fc4 (diff)
downloadAppliGestionPHP-eeda06c4729a36b7a88c5a413978ec8626c867b0.tar.gz
AppliGestionPHP-eeda06c4729a36b7a88c5a413978ec8626c867b0.tar.bz2
AppliGestionPHP-eeda06c4729a36b7a88c5a413978ec8626c867b0.zip
mise en place de l'héritage 3, patch bug doctrine
Diffstat (limited to 'patched fetchTableColumns.txt')
-rw-r--r--patched fetchTableColumns.txt55
1 files changed, 55 insertions, 0 deletions
diff --git a/patched fetchTableColumns.txt b/patched fetchTableColumns.txt
new file mode 100644
index 0000000..d677034
--- /dev/null
+++ b/patched fetchTableColumns.txt
@@ -0,0 +1,55 @@
1<?php
2// replace fetchTableColumns by this one in vendor/doctrine/dbal/src/Schema/SQLiteSchemaManager.php at line 466
3
4protected function fetchTableColumns(string $databaseName, ?string $tableName = null): array
5{
6 $rows = parent::fetchTableColumns($databaseName, $tableName);
7
8 $sqlByTable = $pkColumnNamesByTable = $foreignKeyColumnsByTable = $result = [];
9
10 foreach ($rows as $row) {
11 $tableName = $row['table_name'];
12
13 $sqlByTable[$tableName] ??= $this->getCreateTableSQL($tableName);
14
15 if ($row['pk'] !== 0 && $row['pk'] !== '0') {
16 $pkColumnNamesByTable[$tableName][] = $row['name'];
17 }
18 }
19
20 // -----
21 $foreignKeyRows = $this->connection->fetchAllAssociative(
22 <<<'SQL'
23 SELECT t.name AS table_name,
24 p."from" AS column_name
25 FROM sqlite_master t
26 JOIN pragma_foreign_key_list(t.name) p
27 WHERE t.type = 'table'
28 SQL,
29 );
30
31 foreach ($foreignKeyRows as $foreignKeyRow) {
32 $foreignKeyColumnsByTable[$foreignKeyRow['table_name']]
33 [$foreignKeyRow['column_name']] = true;
34 }
35 // -----
36
37 foreach ($rows as $row) {
38 $tableName = $row['table_name'];
39 $columnName = $row['name'];
40 $tableSQL = $sqlByTable[$tableName];
41
42 $result[] = array_merge($row, [
43 // -----
44 'autoincrement' => isset($pkColumnNamesByTable[$tableName])
45 && $pkColumnNamesByTable[$tableName] === [$columnName]
46 && $row['type'] === 'INTEGER'
47 && ! isset($foreignKeyColumnsByTable[$tableName][$columnName]),
48 // -----
49 'collation' => $this->parseColumnCollationFromSQL($columnName, $tableSQL),
50 'comment' => $this->parseColumnCommentFromSQL($columnName, $tableSQL),
51 ]);
52 }
53
54 return $result;
55} \ No newline at end of file