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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andreakeesys
Copy link

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).

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
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
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
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
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