Skip to content

Commit 9c184ec

Browse files
committed
Post merge fixes - continue
1 parent 7d7c2d9 commit 9c184ec

18 files changed

Lines changed: 79 additions & 88 deletions

File tree

app/bundles/ApiBundle/Controller/FetchCommonApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ protected function getBatchEntities($parameters, &$errors, $prepareForSerializat
461461
$model = $model ?: $this->model;
462462

463463
$entities = [];
464-
if (!empty($validIds)) {
464+
if ([] !== $validIds) {
465465
$entities = $model->getEntities(
466466
[
467467
'filter' => [

app/bundles/CampaignBundle/Entity/CampaignRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ public function getCampaignsSegmentShare(int $segmentId, array $campaignIds = []
627627
't',
628628
't.lead_id = cl.lead_id'
629629
)
630-
->setParameter('segmentId', (int) $segmentId)
630+
->setParameter('segmentId', $segmentId)
631631
->groupBy('c.id');
632632

633633
if ([] !== $campaignIds) {

app/bundles/CampaignBundle/Entity/SummaryRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ public function summarize(
148148
';
149149

150150
if (null !== $campaignId) {
151-
$innerSql .= ' AND mclel.campaign_id = '.(int) $campaignId;
151+
$innerSql .= ' AND mclel.campaign_id = '.$campaignId;
152152
}
153153

154154
if (null !== $eventId) {
155-
$innerSql .= ' AND mclel.event_id = '.(int) $eventId;
155+
$innerSql .= ' AND mclel.event_id = '.$eventId;
156156
}
157157

158158
$innerSql .= ' GROUP BY mclel.campaign_id, mclel.event_id';

app/bundles/CategoryBundle/Tests/Controller/CategoryControllerFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ public function testEditCategorySavesWhenApplyButtonIsDisabled(): void
139139
public function testEditLockCategory(): void
140140
{
141141
/** @var CategoryModel $categoryModel */
142-
$categoryModel = static::getContainer()->get(CategoryModel::class);
142+
$categoryModel = self::getContainer()->get(CategoryModel::class);
143143
$user = $this->getUser(self::SALES_USER);
144144

145145
$category = new Category();
146146
$category->setTitle('New Category');
147147
$category->setAlias('category');
148148
$category->setBundle('global');
149-
$this->assertInstanceOf(User::class, $user);
149+
$this->assertNull($user);
150150
$category->setCheckedOutBy($user);
151151
$category->setCheckedOut(new \DateTime('now'));
152152
$categoryModel->saveEntity($category, false);

app/bundles/CoreBundle/Doctrine/AbstractMauticMigration.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,26 @@ public function setPrefix(string $prefix): void
7777
$this->prefix = $prefix;
7878
}
7979

80-
protected function indexExists(string $tableName, string $indexName): bool
80+
protected function indexExists(string $tableName, string $indexName, array $columns = []): bool
8181
{
8282
$indexes = $this->getIndexes($tableName);
8383

8484
$lowerIndexName = strtolower($indexName);
85+
$expectedColumns = array_map('strtolower', $columns);
8586
foreach ($indexes as $index) {
86-
if (strtolower($index->getName()) === $lowerIndexName) {
87+
if (strtolower($index->getName()) !== $lowerIndexName) {
88+
continue;
89+
}
90+
91+
// Name matches – if no columns were requested, we're done
92+
if ([] === $expectedColumns) {
93+
return true;
94+
}
95+
96+
// Compare columns (order matters)
97+
$actualColumns = array_map('strtolower', $index->getColumns());
98+
99+
if ($actualColumns === $expectedColumns) {
87100
return true;
88101
}
89102
}

app/bundles/CoreBundle/Doctrine/DatabasePlatform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public static function getTimeSpentFormula(?AbstractPlatform $platform, string $
513513
*
514514
* Prefers non-primary unique constraint if available, otherwise falls back to primary key.
515515
*/
516-
public static function getUpsertConflictTarget(Connection $connection, ClassMetadata $metadata, string $pkColumn): ?string
516+
public static function getUpsertConflictTarget(Connection $connection, ClassMetadata $metadata, string $pkColumn): string
517517
{
518518
/**
519519
* Currently Unique Constrains are only used in PostgreSQL

app/bundles/CoreBundle/Doctrine/GeneratedColumn/GeneratedColumn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getAddColumnSql(?AbstractPlatform $platform = null): string
8585
{
8686
$add = DatabasePlatform::getAddColumnKeyword($platform);
8787

88-
return "{$add} {$this->getColumnName()} {$this->getColumnDefinition($platform)}";
88+
return "{$add} {$this->columnName} {$this->getColumnDefinition($platform)}";
8989
}
9090

9191
public function getAddIndexSql(): string

app/bundles/CoreBundle/Doctrine/Helper/IndexSchemaHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function dropIndex($columns, $name, $options = []): static
122122
{
123123
$textColumns = $this->getTextColumns($columns);
124124

125-
if (empty($textColumns)) {
125+
if ([] === $textColumns) {
126126
return $this;
127127
}
128128

@@ -214,7 +214,7 @@ private function tableHasIndex(string $tableName, string $indexName, array $inde
214214
{
215215
foreach ($this->getTableIndexes($tableName) as $idx) {
216216
if (strtolower($idx->getName()) === strtolower($indexName)) {
217-
if (empty($indexColumns)) {
217+
if ([] === $indexColumns) {
218218
return true;
219219
}
220220
$columns = $idx->getColumns();

app/bundles/CoreBundle/Test/MauticMysqlTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class MauticMysqlTestCase extends AbstractMauticTestCase
2222

2323
private bool $databaseInstalled = false;
2424

25-
private bool $setUpInvoked = false;
25+
private bool $setUpInvoked;
2626

2727
/**
2828
* Use transaction rollback for cleanup. Sometimes it is not possible to use it because of the following:
@@ -317,7 +317,7 @@ private function resetDatabase(): void
317317

318318
$prefixedTables = array_filter($tables, fn (string $table): bool => str_starts_with($table, $prefix));
319319

320-
if (!empty($prefixedTables)) {
320+
if ([] !== $prefixedTables) {
321321
$quotedTables = array_map($this->connection->quoteIdentifier(...), $prefixedTables);
322322
$this->connection->executeStatement(
323323
self::TRUNCATE_TABLE_SQL.' '.implode(', ', $quotedTables).' RESTART IDENTITY CASCADE'
@@ -396,7 +396,7 @@ private function generatePostgresqlResetSql(string $file): void
396396

397397
$prefixedTables = array_filter($tables, fn (string $table): bool => str_starts_with($table, $prefix));
398398

399-
if (empty($prefixedTables)) {
399+
if ([] !== $prefixedTables) {
400400
// Nothing to do
401401
file_put_contents($file, '-- No tables to truncate');
402402

app/bundles/InstallBundle/Helper/SchemaHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private function backupExistingSchema($tables, array $mauticTables, $backupPrefi
268268
} else {
269269
// existing backup to be dropped
270270
$dropTables[] = $t;
271-
array_push($dropSequences, $sequence);
271+
$dropSequences[] = $sequence;
272272
}
273273

274274
foreach ($restraints as $restraint) {

0 commit comments

Comments
 (0)