doctrine /
dbal
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Schema\Synchronizer; |
||
| 6 | |||
| 7 | use Doctrine\DBAL\Connection; |
||
| 8 | use Throwable; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Abstract schema synchronizer with methods for executing batches of SQL. |
||
| 12 | */ |
||
| 13 | abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer |
||
| 14 | { |
||
| 15 | /** @var Connection */ |
||
| 16 | protected $conn; |
||
| 17 | |||
| 18 | 88 | public function __construct(Connection $conn) |
|
| 19 | { |
||
| 20 | 88 | $this->conn = $conn; |
|
| 21 | 88 | } |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param array<int, string> $sql |
||
| 25 | */ |
||
| 26 | protected function processSqlSafely(array $sql) : void |
||
| 27 | { |
||
| 28 | foreach ($sql as $s) { |
||
| 29 | try { |
||
| 30 | $this->conn->exec($s); |
||
| 31 | } catch (Throwable $e) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
Loading history...
|
|||
| 32 | } |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param array<int, string> $sql |
||
| 38 | */ |
||
| 39 | 44 | protected function processSql(array $sql) : void |
|
| 40 | { |
||
| 41 | 44 | foreach ($sql as $s) { |
|
| 42 | 44 | $this->conn->exec($s); |
|
| 43 | } |
||
| 44 | 44 | } |
|
| 45 | } |
||
| 46 |