Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doctrine): support backed enum for faceted properties #4

Merged

Conversation

daFish
Copy link
Contributor

@daFish daFish commented Mar 11, 2025

When using the Doctrine adapter and having a property of type enumType, facetting on the property does not work.

This change checks if the property is of type BackedEnum and handles this case.

@daFish daFish force-pushed the feat/doctrine-adapter-enum-types branch 2 times, most recently from bb6a4df to 182595d Compare March 11, 2025 15:22
Copy link
Member

@julienj julienj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! 🙌

You're absolutely right—this was an oversight. Handling BackedEnum properties properly in the Doctrine adapter is essential, and your fix is much appreciated

@@ -93,10 +93,13 @@ private function getFacetDistributions(Query $query, SearchInterface $search): a
$uncheckedFacets = [];
$qb = $helper->getFacetTermQuery($facet);
foreach ($qb->getQuery()->getArrayResult() as $row) {
if (\in_array($row['value'], $checkedValues)) {
$checkedFacets[$row['value']] = $row['total'];
$rowValue = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken, this line is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. I have removed the line. Should be good know.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it's all good, i will merge your PR and tag a new version

@daFish daFish force-pushed the feat/doctrine-adapter-enum-types branch from 182595d to b96da1f Compare March 12, 2025 08:17
@AlexandrePetrone AlexandrePetrone merged commit 1bfefd2 into Mezcalito:0.x Mar 12, 2025
10 checks passed
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.

3 participants