Skip to content

Commit

Permalink
Fixed deprecation and setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed May 31, 2024
1 parent 208a6df commit 66013cf
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push: ~
pull_request: ~

permissions: read-all

jobs:
ci:
uses: 'terminal42/contao-build-tools/.github/workflows/build-tools.yml@main'
12 changes: 12 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

return (new Configuration())
->ignoreErrorsOnPackage('doctrine/dbal', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/config', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/dependency-injection', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/http-foundation', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/http-kernel', [ErrorType::SHADOW_DEPENDENCY])
;
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,13 @@
},
"extra": {
"contao-manager-plugin": "Terminal42\\RootcontentBundle\\ContaoManager\\Plugin"
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"php-http/discovery": false,
"contao/manager-plugin": false,
"terminal42/contao-build-tools": true
}
}
}
2 changes: 1 addition & 1 deletion contao/templates/mod_rootcontent.html5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?= $this->article ?>
<?= $this->article;
2 changes: 1 addition & 1 deletion src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Plugin implements BundlePluginInterface
{
public function getBundles(ParserInterface $parser)
public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(Terminal42RootcontentBundle::class)->setLoadAfter([ContaoCoreBundle::class]),
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/RootcontentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function getResponse(Template $template, ModuleModel $model, Request $
return new Response('');
}

$article = $this->getArticle($pageModel->rootId, $model->rootcontent);
$article = $this->getArticle((int) $pageModel->rootId, $model->rootcontent);

if (null === $article) {
return new Response('');
Expand All @@ -42,7 +42,7 @@ protected function getResponse(Template $template, ModuleModel $model, Request $
return $template->getResponse();
}

private function getArticle($rootPageId, $section): ArticleModel|null
private function getArticle(int $rootPageId, string $section): ArticleModel|null
{
$cols = ['tl_article.pid=?', 'tl_article.title=?'];

Expand Down
7 changes: 2 additions & 5 deletions src/EventListener/ArticleSectionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __invoke(DataContainer $dc): void
return;
}

$page = $this->getPage($dc->id);
$page = $this->getPage((int) $dc->id);

if ('root' === $page['type']) {
$GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = '{title_legend},title,author;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID;{publish_legend},published,start,stop';
Expand All @@ -51,10 +51,9 @@ public function __invoke(DataContainer $dc): void
}
}

private function getPage($articleId): array|null
private function getPage(int $articleId): array|null
{
$qb = $this->database->createQueryBuilder();

$qb
->select('tl_page.*')
->from('tl_article')
Expand All @@ -69,7 +68,6 @@ private function getPage($articleId): array|null
private function getTheme(int $layoutId): array|null
{
$qb = $this->database->createQueryBuilder();

$qb
->select('tl_theme.*')
->from('tl_theme')
Expand All @@ -84,7 +82,6 @@ private function getTheme(int $layoutId): array|null
private function getExistingSections(int $pageId, int $articleId = 0): array
{
$qb = $this->database->createQueryBuilder();

$qb
->select('title')
->from('tl_article')
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/RootCssClassListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RootCssClassListener
{
public function __invoke(PageModel $objPage, LayoutModel $objLayout): void
{
$rootPage = PageModel::findByPk($objPage->rootId);
$rootPage = PageModel::findById($objPage->rootId);

if (null !== $rootPage && $cssClass = $rootPage->cssClass) {
$objLayout->cssClass = $cssClass.' '.$objLayout->cssClass;
Expand Down
1 change: 0 additions & 1 deletion src/EventListener/RootLimitListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function __construct(private readonly Connection $database)
public function onRootLimitOptions(): array
{
$qb = $this->database->createQueryBuilder();

$qb
->select('id, title, dns, language')
->from('tl_page')
Expand Down
1 change: 0 additions & 1 deletion src/Routing/RootPageContentComposition.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function supportsContentComposition(PageModel $pageModel): bool
$definedSections = StringUtil::deserialize($qb->execute()->fetchOne(), true);

$qb = $this->connection->createQueryBuilder();

$qb
->select('title')
->from('tl_article')
Expand Down

0 comments on commit 66013cf

Please sign in to comment.