Skip to content

Commit f4bbcf4

Browse files
committed
After review 4
1 parent ee2646b commit f4bbcf4

File tree

5 files changed

+4
-5
lines changed

5 files changed

+4
-5
lines changed

src/Domain/Subscription/Repository/DynamicListAttrRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function fetchSingleOptionName(string $listTable, int $id): ?string
151151
return $val === false ? null : (string) $val;
152152
}
153153

154-
public function existsByName(string $listTable, DynamicListAttrDto $dto): bool
154+
public function isNameTakenByOtherRecord(string $listTable, DynamicListAttrDto $dto): bool
155155
{
156156
if (!preg_match('/^[A-Za-z0-9_]+$/', $listTable)) {
157157
throw new InvalidArgumentException('Invalid list table');

src/Domain/Subscription/Service/Manager/AttributeDefinitionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function update(
8585
->setRequired($attributeDefinitionDto->required)
8686
->setDefaultValue($attributeDefinitionDto->defaultValue);
8787

88-
if ($attributeDefinitionDto->type->isMultiValued()) {
88+
if ($attributeDefinitionDto->type && $attributeDefinitionDto->type->isMultiValued()) {
8989
$tableName = $attributeDefinition->getTableName() ?? $this->dynamicTablesManager
9090
->resolveTableName(name: $attributeDefinitionDto->name, type: $attributeDefinitionDto->type);
9191
$this->dynamicTablesManager->createOptionsTableIfNotExists($tableName);

src/Domain/Subscription/Service/Manager/DynamicListAttrManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private function updateRowsById(array $incomingById, array $currentById, string
241241
$cur = $currentById[$dto->id];
242242
$updates = [];
243243
if ($cur->name !== $dto->name) {
244-
$nameExists = $this->dynamicListAttrRepository->existsByName($listTable, $dto);
244+
$nameExists = $this->dynamicListAttrRepository->isNameTakenByOtherRecord($listTable, $dto);
245245
if ($nameExists) {
246246
throw new RuntimeException('Option name ' . $dto->name . ' already exists.');
247247
}

tests/Integration/Domain/Subscription/Service/DynamicListAttrManagerFunctionalTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ protected function setUp(): void
4444
dynamicListTablePrefix: 'listattr_'
4545
);
4646

47-
$subscriberAttributeValueRepo = null;
4847
$subscriberAttributeValueRepo = self::getContainer()->get(SubscriberAttributeValueRepository::class);
4948

5049
// Get tables manager from container for creating/ensuring dynamic tables

tests/Support/DBAL/FakeDriverException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
class FakeDriverException extends Exception implements DriverException
1717
{
18-
private string|null $sqlState;
18+
private ?string $sqlState;
1919

2020
public function __construct(
2121
string $message = '',

0 commit comments

Comments
 (0)