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

[Tree] Allow uuid as path source in materialized path strategy #2897

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

andreakeesys
Copy link
Contributor

Fixes the following error in Symfony 7.* during cache warmup, with an entity that implements Tree with the materialized path strategy and uses Uuidv7 as primary key:

In Attribute.php line 260: 

Tree PathSource field - [id] type is not valid. It can be any of the integer 
variants, double, float or string in class - App\Entity\<MyEntity>

@phansys phansys added Bug A confirmed bug in Extensions that needs fixing. Tree labels Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.66%. Comparing base (7622db1) to head (3352422).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2897   +/-   ##
=======================================
  Coverage   78.66%   78.66%           
=======================================
  Files         167      167           
  Lines        8746     8746           
=======================================
  Hits         6880     6880           
  Misses       1866     1866           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@phansys phansys 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 @KeeSystemOrg!
Is there a way to test the expected behavior in order to avoid regressions?

@andreakeesys
Copy link
Contributor Author

andreakeesys commented Nov 25, 2024

Hi @phansys I just pushed a commit that contains a new fixture and test class. When removing the change in Validator.php the test breaks with the same error reported in the PR description:

Gedmo\Tests\Tree\MaterializedPathUuidORMTest::testInsertUpdateAndRemove
Gedmo\Exception\InvalidMappingException: Tree PathSource field - [id] type is not valid. It can be any of the integer variants, double, float or string in class - Gedmo\Tests\Tree\Fixture\MPCategoryUuid

@andreakeesys
Copy link
Contributor Author

Hi @phansys I downgraded Uuid to V4 for PHP 7.4 compatibility and added some CS fixes.

Copy link
Collaborator

@phansys phansys left a comment

Choose a reason for hiding this comment

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

In order to keep the changes as narrow as possible regarding the PR goal and to ease the review process, please remove the unrelated changes.

.docker/php/Dockerfile Outdated Show resolved Hide resolved
@andreakeesys andreakeesys force-pushed the main branch 3 times, most recently from c987cc1 to feb082c Compare November 26, 2024 08:09
@andreakeesys andreakeesys requested a review from phansys November 26, 2024 08:13
@andreakeesys andreakeesys force-pushed the main branch 2 times, most recently from cb3ce6e to f9be21d Compare November 26, 2024 12:57
tests/Gedmo/Tree/Fixture/MPCategoryUuid.php Outdated Show resolved Hide resolved
tests/Gedmo/Tree/MaterializedPathUuidORMTest.php Outdated Show resolved Hide resolved
tests/Gedmo/Tree/MaterializedPathUuidORMTest.php Outdated Show resolved Hide resolved
@phansys
Copy link
Collaborator

phansys commented Nov 26, 2024

Triggering the CI after the merge of #2900.

@phansys phansys closed this Nov 26, 2024
@phansys phansys reopened this Nov 26, 2024
- Fixes a path validation error when using an Uuid as primary key in an
  entity and also as TreePathSource in the MaterializedPath strategy
- Added a test to confirm the regression if 'uuid' is removed from the
  allowed types list in Validator.php
@phansys phansys merged commit 5d80d9d into doctrine-extensions:main Nov 30, 2024
23 checks passed
@phansys
Copy link
Collaborator

phansys commented Nov 30, 2024

Thank you @andreakeesys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A confirmed bug in Extensions that needs fixing. Tree
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants