Skip to content

fix: resolve criteria association warnings for blog author and suggest media#84

Merged
lacknere merged 1 commit into
Werkstattl:mainfrom
maurolinopipelino:fix/criteria-association-warnings
May 4, 2026
Merged

fix: resolve criteria association warnings for blog author and suggest media#84
lacknere merged 1 commit into
Werkstattl:mainfrom
maurolinopipelino:fix/criteria-association-warnings

Conversation

@maurolinopipelino
Copy link
Copy Markdown
Contributor

Summary

Closes the warning spam reported in #83 by applying Option A (minimal, no behavior change), as agreed with @lacknere.

Two addAssociation() calls reference associations that don't exist on their target entities, producing Symfony WARNING log entries on every search-suggest request and blog detail load. Data still loads correctly via BlogSubscriber::onBlogEntryLoaded, so this is purely a log-noise fix.

Changes

src/Page/Blog/BlogPageLoader.php

  • Rename addAssociation('author.salutation')addAssociation('blogAuthor.salutation')
  • Drop the now-redundant standalone addAssociation('blogAuthor')

BlogEntryDefinition exposes the relation as blogAuthor (FK author_id); author is a legacy alias that no longer resolves.

src/Content/SalesChannel/Suggest/ProductSuggestDecorated.php

  • Remove addAssociation('media')

Since the teaser image became translatable, media_id lives on BlogEntryTranslationDefinition as an FkField only — AssociationFields are not supported on EntityTranslationDefinitions (per @lacknere's clarification on #83). The hydrated media is now provided by BlogSubscriber::onBlogEntryLoaded, so the criteria-level association is both unresolvable and redundant.

Impact observed in production logs

On a shop running 5.1.3 with regular search-suggest traffic:

  • ~174 warnings/day from the suggest route
  • ~18 warnings/day from blog detail loads

Both go to zero with this change. Frontend behavior unchanged.

Test plan

  • /suggest request with active search-box config: blog tile renders with image, no WARNING in var/log/*.log
  • Blog detail page: author name + salutation render in meta, no WARNING in var/log/*.log

Refs: #83

🤖 Generated with Claude Code

…t media

Two `addAssociation()` calls reference associations that don't exist on
their target entities, producing Symfony WARNINGs in shop logs on every
suggest request and blog detail load.

Changes (Option A from issue Werkstattl#83):

- BlogPageLoader::loadBlogEntry(): rename `author.salutation` to
  `blogAuthor.salutation` and drop the now-redundant standalone
  `blogAuthor` association. The correct association on
  BlogEntryDefinition is `blogAuthor` (author_id FK); `author` is a
  legacy alias that no longer resolves.

- ProductSuggestDecorated::getBlogs(): remove
  `addAssociation('media')`. Since the teaser image became translatable,
  `media_id` lives on BlogEntryTranslationDefinition as a FkField; the
  hydrated media is now provided by `BlogSubscriber::onBlogEntryLoaded`,
  so the criteria-level association is both unresolvable and redundant.

Refs: Werkstattl#83
@lacknere lacknere self-assigned this May 4, 2026
@lacknere lacknere merged commit c7e8613 into Werkstattl:main May 4, 2026
4 checks passed
@lacknere
Copy link
Copy Markdown
Collaborator

lacknere commented May 4, 2026

Thanks for your contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants