Compare commits

..

2 Commits

Author SHA1 Message Date
Jürgen Mummert 00f65ffd45 Fix nullable logger guard in organization listing listener 2026-02-22 17:12:29 +01:00
Jürgen Mummert 142cab2203 Broaden organization tag enrichment fallbacks for production data variants 2026-02-22 17:10:39 +01:00
@@ -17,7 +17,7 @@ class OrganizationListingTemplateDataListener
{
public function __construct(
private readonly Connection $connection,
private readonly LoggerInterface $logger,
private readonly ?LoggerInterface $logger = null,
) {
}
@@ -146,7 +146,7 @@ class OrganizationListingTemplateDataListener
}
}
if ($rowsWithoutTagSlugs > 0) {
if (null !== $this->logger && $rowsWithoutTagSlugs > 0) {
$this->logger->warning('Organization listing tag enrichment left rows without tag slugs.', [
'template' => (string) $template->getName(),
'totalRows' => \count($tbody),
@@ -312,6 +312,22 @@ class OrganizationListingTemplateDataListener
)->fetchAllAssociative();
}
if ([] === $rows) {
$rows = $this->connection->executeQuery(
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE r.field = ? AND r.pid IN (?) ORDER BY r.pid ASC, r.tag_id ASC',
['tags', $organizationIds],
[ParameterType::STRING, ArrayParameterType::INTEGER],
)->fetchAllAssociative();
}
if ([] === $rows) {
$rows = $this->connection->executeQuery(
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE r.pid IN (?) ORDER BY r.pid ASC, r.tag_id ASC',
[$organizationIds],
[ArrayParameterType::INTEGER],
)->fetchAllAssociative();
}
$map = [];
$seen = [];
@@ -361,6 +377,22 @@ class OrganizationListingTemplateDataListener
[ParameterType::STRING, ArrayParameterType::STRING],
)->fetchAllAssociative();
if ([] === $rows) {
$rows = $this->connection->executeQuery(
'SELECT o.title, r.tag_id, t.tag AS label FROM tl_organization o INNER JOIN tl_tags_rel r ON r.pid = o.id AND r.field = ? INNER JOIN tl_tags t ON t.id = r.tag_id WHERE o.title IN (?) ORDER BY o.title ASC, r.tag_id ASC',
['tags', $titles],
[ParameterType::STRING, ArrayParameterType::STRING],
)->fetchAllAssociative();
}
if ([] === $rows) {
$rows = $this->connection->executeQuery(
'SELECT o.title, r.tag_id, t.tag AS label FROM tl_organization o INNER JOIN tl_tags_rel r ON r.pid = o.id INNER JOIN tl_tags t ON t.id = r.tag_id WHERE o.title IN (?) ORDER BY o.title ASC, r.tag_id ASC',
[$titles],
[ArrayParameterType::STRING],
)->fetchAllAssociative();
}
$map = [];
$seen = [];