DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

[Tree] [NestedSet] New additions

Open pmishev opened this issue 3 years ago • 3 comments

  • [Tree] [NestedSet] Added "base" property for tree level annotation
  • [Tree] [NestedSet] Added 'includeNode' option in getPathQueryBuilder() to specify whether you want the starting node included or not
  • [Tree] [NestedSet] Added getPathAsString() method to entity repository
  • [Tree] [NestedSet] Added 'treeRootNode' options in verify() in case you want to verify a single tree in a forest
  • [Tree] [NestedSet] Added recoverFast() method for where speed is more important than safety and entity manager state
  • [Tree] [NestedSet] Added options to recover() for sibling order, tree root in a forest, verification skip and auto-flushing
  • [Tree] [NestedSet] Verify and recover wrong levels in nested set
  • [Tree] [NestedSet] Added test for removing parent node from tree

pmishev avatar Apr 29 '22 11:04 pmishev

Codecov Report

Base: 79.90% // Head: 80.03% // Increases project coverage by +0.13% :tada:

Coverage data is based on head (a9c9804) compared to base (af47302). Patch coverage: 87.33% of modified lines in pull request are covered.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2447      +/-   ##
============================================
+ Coverage     79.90%   80.03%   +0.13%     
- Complexity     3136     3150      +14     
============================================
  Files           160      160              
  Lines          8191     8301     +110     
============================================
+ Hits           6545     6644      +99     
- Misses         1646     1657      +11     
Impacted Files Coverage Δ
src/Tree/TreeListener.php 98.11% <ø> (ø)
src/Mapping/Annotation/TreeLevel.php 42.85% <42.85%> (ø)
...rc/Tree/Entity/Repository/NestedTreeRepository.php 90.88% <88.80%> (-0.74%) :arrow_down:
src/Tree/Mapping/Driver/Annotation.php 76.47% <100.00%> (+0.71%) :arrow_up:
src/Tree/Strategy/ORM/Nested.php 94.85% <100.00%> (ø)
src/Tree/RepositoryUtils.php 96.29% <0.00%> (ø)
src/Tree/Strategy/ORM/Closure.php 97.90% <0.00%> (ø)
src/Uploadable/UploadableListener.php 89.28% <0.00%> (ø)
src/References/Mapping/Event/Adapter/ORM.php 60.00% <0.00%> (ø)
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Jun 22 '22 10:06 codecov-commenter

If there are no other changes you'd like me to make, do you want me to do a rebase onto main?

pmishev avatar Jun 27 '22 11:06 pmishev

Thanks for fixing this, I just encountered the error and it took a while for me to stumble upon this PR.

DennisCodeBuds avatar Aug 12 '22 14:08 DennisCodeBuds

Just checking in to see if you need anything more fixed in this PR?

pmishev avatar Jan 13 '23 18:01 pmishev

Just checking in to see if you need anything more fixed in this PR?

Just a rebase to fix the conflict in the CHANGLOG:md file from my side, let see if @phansys can give another review.

franmomu avatar Jan 13 '23 18:01 franmomu

Did the rebase. As far as the @param are concerned, we had a discussion about those above. I did some research then and didn't find any consensus on what's the best way to document those, so I picked one that seemed the least bad. I don't really care much about those, so if you prefer another one, I can change them.

pmishev avatar Jan 15 '23 15:01 pmishev

I don't really care much about those, so if you prefer another one, I can change them.

For lack of a better example, I think this one a bit tidier.

phansys avatar Jan 19 '23 22:01 phansys

So, instead of this:

     * @param object $node
     * @param array  $options = [
     *                        'includeNode' => true, // Whether to include the node itself
     *                        ]
     *
     * @phpstan-param array{includeNode?: bool} $options

it would be this:

     * @param object $node
     * @phpstan-param array{includeNode?: bool} $options
     *
     * options:
     * - includeNode: (bool) Whether to include the node itself. Defaults to true.

Just to point out the cons I see in this format:

  • The default values are not immediately obvious.
  • The $option will no longer have a @param annotation

Please confirm and I'll change them.

pmishev avatar Jan 22 '23 21:01 pmishev

Thanks @pmishev. As I mentioned, I don't want to block this PR. Regarding your points, I guess we can keep the @param tag if it adds some value, like @param array<string, mixed> $options. About the default value, I find the example explicit enough.

phansys avatar Jan 23 '23 01:01 phansys

Great job! Could you please update the Tree docs in order to explain how to use these additions?

done

pmishev avatar Jan 30 '23 22:01 pmishev

thanks for keeping working on this @pmishev! and sorry for taking that long

franmomu avatar Mar 07 '23 06:03 franmomu