Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/ClickHousePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
use FOD\DBALClickHouse\Types\StringableClickHouseType;
use FOD\DBALClickHouse\Types\UnsignedNumericalClickHouseType;

use function addslashes;
use function array_filter;
use function array_key_exists;
use function array_keys;
Expand Down Expand Up @@ -479,7 +478,7 @@
*/
protected function _getCreateTableSQL(string $name, array $columns, array $options = []): array
{
$engine = !empty($options['engine']) ? $options['engine'] : 'ReplacingMergeTree';

Check failure on line 481 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'engine' on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string} in empty() does not exist.

Check failure on line 481 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'engine' does not exist on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string}.
$engineOptions = '';

$columns = \array_column($columns, null, 'name');
Expand All @@ -495,7 +494,7 @@
/**
* MergeTree* specific section
*/
if (in_array(

Check failure on line 497 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to function in_array() with arguments 'ReplacingMergeTree', array{'MergeTree', 'CollapsingMergeTree', 'SummingMergeTree', 'AggregatingMergeTree', 'ReplacingMergeTree', 'GraphiteMergeTree'} and true will always evaluate to true.
$engine,
[
'MergeTree',
Expand All @@ -507,7 +506,7 @@
],
true
)) {
$indexGranularity = !empty($options['indexGranularity']) ? $options['indexGranularity'] : 8192;

Check failure on line 509 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'indexGranularity' on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string} in empty() does not exist.

Check failure on line 509 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'indexGranularity' does not exist on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string}.
$samplingExpression = '';

/**
Expand All @@ -518,8 +517,8 @@
'default' => 'today()',
];

if (!empty($options['eventDateProviderColumn'])) {

Check failure on line 520 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'eventDateProviderCo…' on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string} in empty() does not exist.
$options['eventDateProviderColumn'] = trim($options['eventDateProviderColumn']);

Check failure on line 521 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'eventDateProviderColumn' does not exist on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string}.

if (!isset($columns[$options['eventDateProviderColumn']])) {
throw new \Exception(
Expand All @@ -537,7 +536,7 @@
!($columns[$options['eventDateProviderColumn']]['type'] instanceof DecimalType) &&
(
!($columns[$options['eventDateProviderColumn']]['type'] instanceof StringType) ||
$columns[$options['eventDateProviderColumn']]['fixed']

Check failure on line 539 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'fixed' does not exist on array{name: string, type: Doctrine\DBAL\Types\StringType, default: mixed, notnull?: bool, autoincrement: bool, columnDefinition: non-empty-string|null, comment: string, charset?: non-empty-string|null, ...}.
)
) {
throw new \Exception(
Expand All @@ -555,7 +554,7 @@
('toDate(' . $options['eventDateProviderColumn'] . ')');
}

if (empty($options['eventDateColumn'])) {

Check failure on line 557 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'eventDateColumn' on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string} in empty() does not exist.
$dateColumns = array_filter($columns, fn (array $column): bool => $column['type'] instanceof DateType);

if ($dateColumns) {
Expand All @@ -570,7 +569,7 @@
}

$eventDateColumnName = 'EventDate';
} elseif (isset($columns[$options['eventDateColumn']])) {

Check failure on line 572 in src/ClickHousePlatform.php

View workflow job for this annotation

GitHub Actions / PHPStan

Offset 'eventDateColumn' does not exist on array{primary?: list<string>, primary_index?: Doctrine\DBAL\Schema\Index, indexes?: list<Doctrine\DBAL\Schema\Index>, uniqueConstraints?: list<Doctrine\DBAL\Schema\UniqueConstraint>, foreignKeys?: list<Doctrine\DBAL\Schema\ForeignKeyConstraint>, comment?: string}.
if (!($columns[$options['eventDateColumn']]['type'] instanceof DateType)) {
throw new \Exception(
'In table `' . $name . '` you have set field `' .
Expand Down Expand Up @@ -1079,15 +1078,15 @@
*/
public function quoteStringLiteral(string $str): string
{
return parent::quoteStringLiteral(addslashes($str));
return parent::quoteStringLiteral($str);
}

/**
* {@inheritDoc}
*/
public function quoteSingleIdentifier(string $str): string
{
return parent::quoteSingleIdentifier(addslashes($str));
return parent::quoteSingleIdentifier($str);
}

/**
Expand Down