Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"InspiredMinds\\ContaoFileUsage\\Result\\FileTreeSingleResult",
"InspiredMinds\\ContaoFileUsage\\Result\\ResultInterface",
"InspiredMinds\\ContaoFileUsage\\Result\\ResultsCollection",
"tl_content"
"tl_content",
"MetaModels\\AttributeContentArticleBundle\\MetaModelsAttributeContentArticleBundle"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
php: [ '8.2', '8.3' ]
contao: [ '~4.13.0' ]
phpcq_install: [ 'update' ]
output: [ '-o github-action -o default' ]
Expand Down
14 changes: 14 additions & 0 deletions .phpcq.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ phpcq:
phpunit:
version: ^1.0
signed: false
requirements:
phpunit:
version: ^11.5.48
psalm:
version: ^1.0
signed: false
requirements:
psalm:
version: ^5.26.1
composer-require-checker:
version: ^1.0
signed: false
Expand All @@ -36,22 +42,30 @@ phpcq:
trusted-keys:
# composer-require-checker
- 033E5F8D801A2F8D
- B2BDAAAC6F1FDE528CD9EEC9033E5F8D801A2F8D
# sb@sebastian-bergmann.de
- 4AA394086372C20A
- D8406D0D82947747293778314AA394086372C20A
# psalm
- 8A03EA3B385DBAA1
- 12CE0F1D262429A5
- 2DE50EB60C013FFFA831040D12CE0F1D262429A5
# magl@magll.net
- D2CCAC42F6295E7D
# PHP_CodeSniffer
- 31C7E470E2138192
- 5E6DDE998AB73B8E
- A978220305CD5C32
- 689DAD778FF08760E046228BA978220305CD5C32
- 97B02DD8E5071466
- D91D86963AF3A29B6520462297B02DD8E5071466
# Composer normalize
- C00543248C87FB13
- 0FDE18AE1D09E19F60F6B1CBC00543248C87FB13
# phpmd
- A4E55EA12C7C085C
- 9093F8B32E4815AA
- E7A745102ECC980F7338B3079093F8B32E4815AA

tasks:
fix:
Expand Down
11 changes: 9 additions & 2 deletions src/EventListener/BackendEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,18 @@ private function duplicateContentEntries($strTable, $intSourceId, $intDestinatio
$arrContent['pid'] = $intDestinationId;
unset($arrContent['id']);

$parameters = [];
foreach (array_keys($arrContent) as $key) {
$parameters[$key] = '?';
}

$this->connection
->createQueryBuilder()
->insert('tl_content')
->setParameters($arrContent)
->executeQuery();
->values($parameters)
->setParameters(array_values($arrContent))
->executeStatement()
;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/listeners.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
MetaModels\AttributeTranslatedContentArticleBundle\EventListener\BackendEventListener:
public: false
arguments:
- '@database_connection'
tags:
- name: kernel.event_listener,
event: 'dc-general.view.contao2backend.manipulate-widget'
Expand Down
5 changes: 0 additions & 5 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ services:
tags:
- { name: metamodels.attribute_factory }

MetaModels\AttributeTranslatedContentArticleBundle\EventListener\BackendEventListener:
public: true
arguments:
- '@database_connection'

MetaModels\AttributeTranslatedContentArticleBundle\Controller\Backend\MetaModelController:
tags: ['controller.service_arguments']
4 changes: 3 additions & 1 deletion tests/ContaoManager/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public function testGetBundles(): void
$config
->expects(self::once())
->method('getLoadAfter')
->willReturn([MetaModelsCoreBundle::class]);
->willReturn([
MetaModelsCoreBundle::class
]);
$config
->expects(self::once())
->method('getReplace')
Expand Down
9 changes: 6 additions & 3 deletions tests/Widgets/ContentArticleWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testNewInstance(): void

$input = $this->getMockBuilder(Adapter::class)
->disableOriginalConstructor()
->setMethods(['get'])
->addMethods(['get'])
->getMock();

$input
Expand All @@ -61,13 +61,16 @@ public function testNewInstance(): void

$widget = $this->getMockBuilder(ContentArticleWidget::class)
->setConstructorArgs([null, $dcCompat, $connection, $input, $translator])
->setMethods(['import'])
->onlyMethods(['import'])
->getMock();

$widget
->expects(self::any())
->method('import')
->withConsecutive([Config::class, 'Config']);
->willReturnCallback(function ($parameters) {
$this->assertInstanceof(Config::class, $parameters[0]);
$this->assertSame('Config', $parameters[1]);
});

self::assertEmpty($widget->getAttributes());
}
Expand Down