diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ce7790d --- /dev/null +++ b/.github/workflows/ci.yml @@ -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' diff --git a/composer-dependency-analyser.php b/composer-dependency-analyser.php new file mode 100644 index 0000000..1dd00c9 --- /dev/null +++ b/composer-dependency-analyser.php @@ -0,0 +1,12 @@ +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]) +; diff --git a/composer.json b/composer.json index 17a0b52..492bbb1 100644 --- a/composer.json +++ b/composer.json @@ -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 + } } } diff --git a/contao/templates/mod_rootcontent.html5 b/contao/templates/mod_rootcontent.html5 index 2dca091..999ca7e 100644 --- a/contao/templates/mod_rootcontent.html5 +++ b/contao/templates/mod_rootcontent.html5 @@ -1 +1 @@ -article ?> \ No newline at end of file +article; diff --git a/src/ContaoManager/Plugin.php b/src/ContaoManager/Plugin.php index 891a59c..0253dda 100644 --- a/src/ContaoManager/Plugin.php +++ b/src/ContaoManager/Plugin.php @@ -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]), diff --git a/src/Controller/RootcontentController.php b/src/Controller/RootcontentController.php index 7549b82..c60b422 100644 --- a/src/Controller/RootcontentController.php +++ b/src/Controller/RootcontentController.php @@ -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(''); @@ -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=?']; diff --git a/src/EventListener/ArticleSectionListener.php b/src/EventListener/ArticleSectionListener.php index f65ee90..66b2340 100644 --- a/src/EventListener/ArticleSectionListener.php +++ b/src/EventListener/ArticleSectionListener.php @@ -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'; @@ -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') @@ -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') @@ -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') diff --git a/src/EventListener/RootCssClassListener.php b/src/EventListener/RootCssClassListener.php index 24cb36d..b761850 100644 --- a/src/EventListener/RootCssClassListener.php +++ b/src/EventListener/RootCssClassListener.php @@ -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; diff --git a/src/EventListener/RootLimitListener.php b/src/EventListener/RootLimitListener.php index 6968073..2e53f7f 100644 --- a/src/EventListener/RootLimitListener.php +++ b/src/EventListener/RootLimitListener.php @@ -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') diff --git a/src/Routing/RootPageContentComposition.php b/src/Routing/RootPageContentComposition.php index cec0acd..875976e 100644 --- a/src/Routing/RootPageContentComposition.php +++ b/src/Routing/RootPageContentComposition.php @@ -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')