Skip to content

Add support for Doctrine ORM 3#17635

Closed
loic425 wants to merge 1 commit intoSylius:2.1from
loic425:orm-3
Closed

Add support for Doctrine ORM 3#17635
loic425 wants to merge 1 commit intoSylius:2.1from
loic425:orm-3

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Jan 17, 2025

Q A
Branch? 2.0
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets
License MIT

It required #17657 first

Summary by CodeRabbit

  • Chores
    • Updated dependency constraints and conflict settings to support newer major library versions and ensure future compatibility.

  • Refactor
    • Improved internal type declarations, namespace usage, and query handling logic to enhance code consistency and maintainability.

These adjustments strengthen the overall stability and readiness of the platform without altering user-facing functionality.

@loic425 loic425 requested review from a team as code owners January 17, 2025 17:07
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 17, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request updates dependency version constraints across multiple Sylius packages. Changes include updating doctrine/orm from "^2.18" to "^2.18 || ^3.3", shifting sylius resource and resource-bundle versions from "^1.12" to the newer "^1.13@alpha", and switching sylius-labs/association-hydrator to "dev-orm-3". In addition, conflict declarations are removed, type hints for Doctrine metadata have been updated from ClassMetadataInfo to ClassMetadata, repository types have been generalized to RepositoryInterface, and several test and DQL parser files now use updated namespaces and return types.

Changes

File(s) Change Summary
composer.json files in Sylius library, Bundles (AddressingBundle, AttributeBundle, ChannelBundle, CoreBundle, CurrencyBundle, CustomerBundle, InventoryBundle, LocaleBundle, MoneyBundle, OrderBundle, PaymentBundle, PayumBundle, ProductBundle, PromotionBundle, ReviewBundle, ShippingBundle, TaxationBundle, TaxonomyBundle, UserBundle) and Components (Addressing, Attribute, Channel, Core, Currency, Customer, Inventory, Locale, Order, Payment, Product, Promotion, Review, Shipping, Taxonomy, User) Updated dependency constraints: doctrine/orm now "^2.18
src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceDeleteHandler.php
src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
Changed type hints from ClassMetadataInfo to ClassMetadata; updated ORMException import from Doctrine\ORM\ORMException to Doctrine\ORM\Exception\ORMException; introduced an anonymous exception class in specs.
Test specs and repository files (e.g., SequentialOrderNumberGeneratorSpec.php, ReviewerReviewsRemoverSpec.php, RemoveItemFromCartHandlerSpec.php) Replaced concrete repository types (EntityRepository) with RepositoryInterface; updated method signatures in tests for consistency.
DQL parser files (DateFormat.php, Day.php, Hour.php, Month.php, Week.php, Year.php) Replaced Lexer token type references with TokenType; added explicit return type declarations in parsing methods.
API Query Extension specs (various Shop/Order, Shop/OrderItem, VisitorBasedExtensionSpec, etc.) Refined query expression handling by switching from Expr\Func to Expr\Comparison, Expr\Andx, and Expr\Orx; enhanced query builder chaining with setParameter returning the builder.
Lifecycle and event handling specs (CanonicalizerListenerSpec.php, ReviewChangeListenerSpec.php, PasswordUpdaterListenerSpec.php) Updated LifecycleEventArgs import from Doctrine\ORM\Event to Doctrine\Persistence\Event; modified constructor visibility in ReviewChangeListener.
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php Updated parent resource resolution: replaced repository lookup with UnitOfWork and EntityPersister for entity loading.
src/Sylius/Bundle/CoreBundle/Doctrine/ORM/SqlWalker/OrderByIdentifierSqlWalker.php Added return type declaration for the walkSelectStatement method (now returns a string).

Poem

Oh, how my paws do tap with glee,
As code is hopped to newer ground,
Dependencies dance in unity,
With type hints smart and errors drowned.
A carrot of change, crisp and bright—
This rabbit cheers with delight!
🥕🐇 Happy code, day and night!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (8)
src/Sylius/Component/Addressing/composer.json (1)

31-31: Consider documenting the alpha dependency requirement.

While the version update is consistent with other components, it would be beneficial to document this alpha dependency requirement and its implications in the project's upgrade guide.

Let's verify if there's existing documentation about this change:

#!/bin/bash
# Check for any upgrade documentation mentioning the alpha version
echo "Searching for upgrade documentation..."
rg -i "1\.13.*alpha|doctrine.*orm.*3" docs/ || echo "No relevant documentation found"
src/Sylius/Component/Taxation/composer.json (1)

33-33: Consider adding a composer conflict constraint.

Since this change is related to testing Doctrine ORM 3 support, consider adding appropriate conflict constraints to prevent installation with incompatible Doctrine ORM versions during the alpha phase.

     "require": {
         "php": "^8.2",
         "sylius/registry": "^1.6",
         "sylius/resource": "^1.13@alpha",
         "symfony/clock": "^6.4 || ^7.1"
     },
+    "conflict": {
+        "doctrine/orm": "<3.0"
+    },
src/Sylius/Component/Customer/composer.json (2)

36-36: Consider updating documentation regarding alpha version usage.

While the update to sylius/resource: ^1.13@alpha is consistent with other components, consider:

  1. Adding a note to the upgrade guide about the use of alpha versions
  2. Documenting any potential implications for users upgrading to this version

Line range hint 31-36: Overall assessment of version updates across components.

The consistent update to sylius/resource: ^1.13@alpha across all components shows a well-coordinated effort to test Doctrine ORM 3 support. However, consider:

  1. Adding a note in the PR description about the use of alpha versions
  2. Creating a tracking issue for reverting to stable versions once testing is complete
  3. Documenting any known limitations or risks in the upgrade guide
src/Sylius/Bundle/CurrencyBundle/composer.json (1)

30-30: Consider the testing strategy for Doctrine ORM 3 compatibility.

The removal of doctrine/orm: >= 3.0 conflicts across bundles indicates preparation for ORM 3 support. Consider:

  1. Adding integration tests specifically for ORM 3
  2. Documenting any known compatibility issues
  3. Creating a compatibility matrix in the documentation

Would you like me to help create a template for ORM 3 specific integration tests?

src/Sylius/Bundle/ReviewBundle/composer.json (1)

Line range hint 1-1: Summary of Recommendations:

  1. 🔄 The changes consistently prepare bundles for Doctrine ORM 3 compatibility
  2. ⚠️ Consider documenting the use of alpha version dependencies
  3. 📝 Create an upgrade guide for the resource-bundle 1.13 release
  4. 🧪 Add comprehensive testing instructions for Doctrine ORM 3
composer.json (1)

76-76: Review stability implications of alpha/dev dependencies.

The combination of alpha versions (^1.13@alpha) and dev branches (dev-orm-3) indicates this is experimental work:

  • sylius/resource and sylius/resource-bundle are using alpha versions
  • sylius-labs/association-hydrator is using a dev branch

This could impact stability. Consider:

  1. Adding a note in the README about the experimental nature
  2. Adding specific version constraints in the release notes

Also applies to: 84-85

src/Sylius/Bundle/OrderBundle/composer.json (1)

34-34: Consider the testing strategy for Doctrine ORM 3 support.

The coordinated updates across bundles to support Doctrine ORM 3 testing require careful consideration:

  1. The widespread use of sylius/resource-bundle: ^1.13@alpha indicates this is a significant architectural change
  2. A comprehensive testing strategy should be documented
  3. Consider adding integration tests that verify the interaction between multiple bundles using Doctrine ORM 3

Would you like me to help create:

  1. A testing strategy document
  2. Integration test examples
  3. A rollback plan in case of issues

Also applies to: 38-38

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27c5ab5 and 154b210.

⛔ Files ignored due to path filters (1)
  • symfony.lock is excluded by !**/*.lock
📒 Files selected for processing (38)
  • composer.json (2 hunks)
  • src/Sylius/Bundle/AddressingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (2 hunks)
  • src/Sylius/Bundle/AttributeBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ChannelBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CoreBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CurrencyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CustomerBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/InventoryBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/MoneyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/OrderBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PaymentBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PayumBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ProductBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PromotionBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ShippingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxationBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxonomyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/UserBundle/composer.json (1 hunks)
  • src/Sylius/Component/Addressing/composer.json (1 hunks)
  • src/Sylius/Component/Attribute/composer.json (1 hunks)
  • src/Sylius/Component/Channel/composer.json (1 hunks)
  • src/Sylius/Component/Core/composer.json (1 hunks)
  • src/Sylius/Component/Currency/composer.json (1 hunks)
  • src/Sylius/Component/Customer/composer.json (1 hunks)
  • src/Sylius/Component/Inventory/composer.json (1 hunks)
  • src/Sylius/Component/Locale/composer.json (1 hunks)
  • src/Sylius/Component/Order/composer.json (1 hunks)
  • src/Sylius/Component/Payment/composer.json (1 hunks)
  • src/Sylius/Component/Product/composer.json (1 hunks)
  • src/Sylius/Component/Promotion/composer.json (1 hunks)
  • src/Sylius/Component/Review/composer.json (1 hunks)
  • src/Sylius/Component/Shipping/composer.json (1 hunks)
  • src/Sylius/Component/Taxation/composer.json (1 hunks)
  • src/Sylius/Component/Taxonomy/composer.json (1 hunks)
  • src/Sylius/Component/User/composer.json (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/Sylius/Bundle/InventoryBundle/composer.json

[error] 36-36: The key phpstan/phpdoc-parser was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

🪛 GitHub Actions: Continuous Integration (Minimal)
src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php

[error] 75-75: Type error in mapAttributeOnAttributeValue(): Argument #2 ($metadata) must be of type Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\ORM\Mapping\ClassMetadata given

🔇 Additional comments (32)
src/Sylius/Component/Inventory/composer.json (1)

30-30: Consider the implications of using an alpha version.

The change to "sylius/resource": "^1.13@alpha" is part of a coordinated update across multiple components to support Doctrine ORM 3. However, using an alpha version in production could introduce instability.

Let's check the changelog for breaking changes:

✅ Verification successful

Alpha version usage is part of coordinated platform upgrade

The sylius/resource: ^1.13@alpha dependency is part of a deliberate, coordinated upgrade across the entire Sylius platform. This systematic change appears in multiple components and bundles, indicating a planned transition phase that includes Doctrine ORM modernization and removal of legacy database drivers. While alpha versions generally warrant caution, in this context, it's an intentional step in the platform's evolution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for changelog entries related to the alpha version
fd -g CHANGELOG.md -x cat {} | rg -A 5 "1.13.0-alpha"

Length of output: 55


Script:

#!/bin/bash
# Check for other composer.json files using alpha versions
fd composer.json -x grep -l "alpha" {}

# Look for upgrade documentation
fd -g "UPGRADE*.md" -x cat {} | rg -i "1\.13|doctrine|orm 3"

# Check all composer.json files for sylius/resource dependency
fd composer.json -x grep -A 1 -B 1 "sylius/resource" {}

Length of output: 12038

src/Sylius/Component/Order/composer.json (1)

31-31: Changes are consistent with other components.

src/Sylius/Component/Currency/composer.json (1)

30-30: Changes are consistent with other components.

src/Sylius/Component/Promotion/composer.json (1)

31-31: Verify the stability implications of using an alpha version.

The change from stable ^1.12 to alpha ^1.13@alpha for sylius/resource could impact stability. While the PR aims to test Doctrine ORM 3 support, using alpha versions in production dependencies requires careful consideration.

Let's check the stability declarations across components:

✅ Verification successful

Alpha version usage appears coordinated and intentional

The consistent use of ^1.13@alpha across all core components indicates this is a coordinated upgrade related to Doctrine ORM 3 testing. While alpha versions carry stability risks, the synchronized versioning helps prevent compatibility issues. Consider documenting the alpha status clearly in release notes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check stability settings and version constraints across all composer.json files
echo "Checking stability settings..."
fd composer.json --exec sh -c 'echo "\n=== {} ==="; cat {} | jq -r ".minimum-stability, .prefer-stable"'

echo "\nChecking sylius/resource version constraints..."
fd composer.json --exec sh -c 'echo "\n=== {} ==="; cat {} | jq -r ".require.\"sylius/resource\" // empty"'

Length of output: 22535

src/Sylius/Component/Locale/composer.json (1)

31-31: Consistent version constraint update observed.

The update to sylius/resource: ^1.13@alpha aligns with the changes in other components, maintaining consistency across the codebase.

src/Sylius/Component/Taxonomy/composer.json (1)

31-31: Verify compatibility with other dependencies.

The update to sylius/resource: ^1.13@alpha is consistent, but we should verify compatibility with other dependencies, particularly given the PR's goal of testing Doctrine ORM 3 support.

Let's check for any potential conflicts:

src/Sylius/Component/Attribute/composer.json (1)

31-31: Consider stability implications of using alpha version.

While updating to sylius/resource: ^1.13@alpha aligns with testing Doctrine ORM 3 support, using an alpha version in a stable component could impact stability. The prefer-stable setting helps mitigate this, but users should be aware of potential risks.

Run this script to check the impact across dependencies:

✅ Verification successful

Alpha version requirement is part of coordinated ecosystem update

The alpha version requirement is consistently applied across all Sylius components and bundles (37 packages), indicating this is an intentional, coordinated change for testing Doctrine ORM 3 support. This systematic approach actually reduces stability risks compared to isolated alpha version usage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if other packages in the ecosystem are using alpha versions
rg -l "sylius/resource.*@alpha" | sort

Length of output: 1663

src/Sylius/Component/Payment/composer.json (1)

32-32: LGTM! Consistent with other components.

The update to sylius/resource: ^1.13@alpha maintains consistency with other components in the ecosystem.

src/Sylius/Component/Shipping/composer.json (1)

33-33: Verify Doctrine ORM dependencies for this component.

While the update to sylius/resource: ^1.13@alpha is consistent, please verify if this component has any direct or indirect dependencies on Doctrine ORM that might need attention.

Run this script to check for Doctrine ORM dependencies:

src/Sylius/Component/Channel/composer.json (1)

32-32: LGTM! Maintains ecosystem consistency.

The update to sylius/resource: ^1.13@alpha is consistent with the broader effort to test Doctrine ORM 3 support.

src/Sylius/Component/Product/composer.json (1)

34-34: Verify stability implications of using alpha version.

The change to ^1.13@alpha of sylius/resource might introduce instability. While this aligns with testing Doctrine ORM 3 support, we should ensure proper testing is in place.

Let's check if other packages in the ecosystem are using this alpha version:

✅ Verification successful

Alpha version usage is consistent across the ecosystem

The sylius/resource:^1.13@alpha is uniformly adopted across all 37 Sylius components and bundles, including the main composer.json. This coordinated upgrade pattern actually reduces stability risks by ensuring version consistency throughout the ecosystem.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check usage of sylius/resource alpha version across the codebase
rg -l "sylius/resource.*1\.13@alpha" --type json

Length of output: 1673

src/Sylius/Component/Review/composer.json (1)

42-42: Consistent version update across components.

The update to sylius/resource: ^1.13@alpha maintains consistency with other components, which is good for dependency management.

src/Sylius/Component/User/composer.json (1)

38-38: Consistent version update across components.

The update to sylius/resource: ^1.13@alpha maintains consistency with other components, which is good for dependency management.

src/Sylius/Bundle/TaxonomyBundle/composer.json (1)

33-33: Verify Doctrine ORM 3.0 compatibility testing.

The update to sylius/resource-bundle: ^1.13@alpha suggests Doctrine ORM 3.0 compatibility. Let's verify if proper testing is in place.

Let's check for any remaining conflicts with Doctrine ORM 3.0:

✅ Verification successful

Doctrine ORM 3.0 compatibility is properly configured

The codebase is properly configured for Doctrine ORM 3.0 compatibility with:

  • Core dependency updated to doctrine/orm: ^3.3
  • Resource bundle aligned through ^1.13@alpha
  • Extensive Doctrine mapping and test configurations in place
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any remaining doctrine/orm conflicts
rg "doctrine/orm.*[>≥]=\s*3\.0" --type json

Length of output: 45


Script:

#!/bin/bash
# Check for doctrine/orm dependencies in composer files
echo "=== Checking doctrine/orm dependencies ==="
rg "doctrine/orm" --type json -A 2 -B 2

echo -e "\n=== Checking for doctrine test configurations ==="
fd -e xml -e yaml -e yml . | xargs rg -l "doctrine" 

echo -e "\n=== Checking composer.json for doctrine requirements ==="
fd composer.json | xargs cat | jq -r 'select(.require != null) | .require | keys[] | select(contains("doctrine"))'

Length of output: 36962

src/Sylius/Bundle/MoneyBundle/composer.json (1)

29-29: Document testing strategy for alpha version.

While the update to sylius/resource-bundle: ^1.13@alpha aligns with testing Doctrine ORM 3 support, it would be helpful to document the testing strategy and timeline for stabilization.

Let's check for any testing documentation:

src/Sylius/Bundle/ChannelBundle/composer.json (1)

30-30: Verify stability implications of using alpha dependency.

The switch to sylius/resource-bundle: ^1.13@alpha across all bundles might impact stability. While this aligns with testing Doctrine ORM 3 support, ensure:

  1. All breaking changes in the alpha version are documented
  2. A migration guide is available for users
  3. The alpha version is sufficiently tested
src/Sylius/Bundle/LocaleBundle/composer.json (1)

31-31: Verify stability implications of using alpha version.

The update to sylius/resource-bundle: ^1.13@alpha could introduce instability. Since this change is part of testing Doctrine ORM 3 support:

  1. Ensure proper testing with both Doctrine ORM 2.x and 3.x
  2. Consider documenting any known limitations or issues
src/Sylius/Bundle/AttributeBundle/composer.json (2)

33-33: Consistent version constraint update.

The update to sylius/resource-bundle: ^1.13@alpha aligns with other bundles in the ecosystem.


Line range hint 47-49: Consider adding Doctrine ORM 3.x to test matrix.

While the conflict with Doctrine ORM 3.x has been removed, explicit testing against it would help ensure compatibility.

src/Sylius/Bundle/ProductBundle/composer.json (1)

34-34: Consistent version constraint update.

The update to sylius/resource-bundle: ^1.13@alpha aligns with other bundles in the ecosystem.

src/Sylius/Bundle/TaxationBundle/composer.json (1)

33-33: Consistent version constraint update.

The update to sylius/resource-bundle: ^1.13@alpha aligns with other bundles in the ecosystem.

src/Sylius/Bundle/PaymentBundle/composer.json (1)

31-31: Consistent version constraint update.

The update to sylius/resource-bundle: ^1.13@alpha aligns with other bundles in the ecosystem.

src/Sylius/Bundle/ShippingBundle/composer.json (1)

34-34: Consider the risks of using an alpha version dependency.

Using sylius/resource-bundle: ^1.13@alpha in a production environment could lead to instability. Consider:

  • Adding a warning in the documentation about potential API changes
  • Creating a migration guide for the upcoming changes
✅ Verification successful

Alpha version is part of the planned upgrade strategy

The sylius/resource-bundle: ^1.13@alpha dependency is being consistently used across 20 bundles as part of Sylius's coordinated upgrade path to version 2.0. According to the release cycle documentation, version 1.13 is fully supported until January 2025 (maintenance) and April 2025 (security fixes).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if other bundles are consistently using the same version
rg -l "sylius/resource-bundle.*1\.13@alpha" | wc -l

Length of output: 56


Script:

#!/bin/bash
# Check for upgrade notes or documentation about the migration
rg -l "1\.13" UPGRADE* CHANGELOG* README* docs/ -g '!*.json'

Length of output: 472


Script:

#!/bin/bash
# Check changelog and release cycle documentation content
echo "=== CHANGELOG-2.0.md ===="
rg "1\.13" CHANGELOG-2.0.md -A 5
echo -e "\n=== Release Cycle Documentation ===="
cat docs/sylius-2.0-documentation/organization/release-cycle.md

Length of output: 10021

src/Sylius/Bundle/CustomerBundle/composer.json (1)

42-42: Verify doctrine/orm compatibility.

The bundle requires doctrine/orm: ^2.18 but is being prepared for ORM 3 compatibility. Consider:

  • Testing with Doctrine ORM 3 beta/RC versions
  • Documenting any known compatibility issues
src/Sylius/Bundle/PromotionBundle/composer.json (1)

35-37: LGTM! Modern Symfony compatibility is maintained.

The bundle maintains compatibility with both Symfony 6.4 and 7.1, while preparing for Doctrine ORM 3.

src/Sylius/Bundle/ReviewBundle/composer.json (1)

44-44: Consider adding a stability notice.

While most dependencies use stable versions, sylius/resource-bundle: ^1.13@alpha introduces potential instability. Consider:

  • Adding a stability notice in the README
  • Creating an upgrade guide for the 1.13 release
composer.json (1)

46-46: Verify compatibility with Doctrine ORM 3.x upgrade.

The upgrade to Doctrine ORM 3.x is a major version change that may introduce breaking changes.

Run this script to check for potential compatibility issues:

✅ Verification successful

Doctrine ORM 3.x upgrade appears compatible with the codebase

The codebase follows standard Doctrine ORM patterns and doesn't use any deprecated features that would break in version 3.x:

  • Uses stable XML mapping configurations
  • Standard repository patterns
  • Compatible field types and relationships
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for Doctrine ORM 3.x compatibility issues
# Look for deprecated ORM 2.x features that might break in 3.x

# Search for ClassMetadataInfo usage which was renamed in ORM 3
ast-grep --pattern 'ClassMetadataInfo'

# Search for removed features like EntityManager::flush() without parameters
ast-grep --pattern 'EntityManager $_ {
  $$$
  $_->flush()
  $$$
}'

Length of output: 316


Script:

#!/bin/bash
# Search for Doctrine ORM specific patterns

# Check for Doctrine annotations/attributes usage
rg -t php '@(Entity|Table|Column|ManyToOne|OneToMany|ManyToMany|OneToOne|JoinColumn)' -A 2

# Check for EntityManager usage patterns
rg -t php 'EntityManager::(clear|flush|persist|remove|merge)' -A 1

# Look for repository class definitions
rg -t php 'extends (EntityRepository|ServiceEntityRepository)' -A 2

# Check for query builder usage
rg -t php '(createQuery|createQueryBuilder|createNativeQuery)' -A 1

Length of output: 58016


Script:

#!/bin/bash
# Check for PHP 8 attribute-style entity mapping
rg -t php '#\[(Entity|Table|Column|ManyToOne|OneToMany|ManyToMany|OneToOne|JoinColumn)\]' -A 2

# Check for Doctrine mapping files
fd -e xml -e yaml -e yml | grep -i 'doctrine' | xargs cat

Length of output: 70255

src/Sylius/Component/Core/composer.json (1)

48-48: LGTM! Version constraint aligns with root composer.json.

The update to sylius/resource: ^1.13@alpha maintains consistency with the root package.

src/Sylius/Bundle/CoreBundle/composer.json (1)

55-55: LGTM! Version constraint aligns with root composer.json.

The update to sylius/resource-bundle: ^1.13@alpha maintains consistency with the root package.

src/Sylius/Bundle/UserBundle/composer.json (1)

44-44: LGTM! Version constraint aligns with root composer.json.

The update to sylius/resource-bundle: ^1.13@alpha maintains consistency with the root package.

src/Sylius/Bundle/PayumBundle/composer.json (1)

38-38: Verify compatibility with dependent Sylius bundles.

The upgrade to sylius/resource-bundle: ^1.13@alpha needs careful consideration:

  1. This is an alpha version, which may introduce breaking changes
  2. The bundle depends on several other Sylius bundles (core-bundle, currency, order-bundle, payment-bundle)

Run this script to check version compatibility across dependent bundles:

✅ Verification successful

Version compatibility verified across Sylius bundles

The upgrade to sylius/resource-bundle: ^1.13@alpha is consistent with all other Sylius bundles that depend on this package. They all use the same version constraint, indicating this is part of a coordinated update across the ecosystem.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check version constraints in dependent Sylius bundles
# Expected: All dependent bundles should use compatible versions

for bundle in "core-bundle" "currency" "order-bundle" "payment-bundle"; do
  echo "Checking $bundle..."
  if [ -f "src/Sylius/Bundle/${bundle}/composer.json" ]; then
    cat "src/Sylius/Bundle/${bundle}/composer.json" | jq -r '.require["sylius/resource-bundle"] // "not found"'
  elif [ -f "src/Sylius/Component/${bundle}/composer.json" ]; then
    cat "src/Sylius/Component/${bundle}/composer.json" | jq -r '.require["sylius/resource"] // "not found"'
  fi
done

Length of output: 991


Script:

#!/bin/bash
# First, find the correct paths for these bundles
echo "Available bundle paths:"
fd -t f composer.json src/Sylius/Bundle/

echo -e "\nChecking resource-bundle version in each composer.json:"
fd -t f composer.json src/Sylius/Bundle/ -x sh -c 'echo "=== {} ==="; cat {} | jq -r ".require[\"sylius/resource-bundle\"] // empty"'

Length of output: 4971

src/Sylius/Bundle/OrderBundle/composer.json (1)

34-34: Consider adding test coverage for Doctrine ORM 3.

While removing the conflict with Doctrine ORM 3 and upgrading to sylius/resource-bundle: ^1.13@alpha, consider:

  1. Adding test cases specifically for Doctrine ORM 3 compatibility
  2. Updating the dev dependency doctrine/orm: ^2.18 to include version 3 for testing

Run this script to check Doctrine ORM usage in tests:

✅ Verification successful

Removing the Doctrine ORM 3 conflict is safe for this bundle

The bundle's tests show that it interacts with Doctrine through stable interfaces (EntityManagerInterface, ObjectManager) and basic UnitOfWork operations, without relying on version-specific ORM features. Additional test coverage for Doctrine ORM 3 is not critical because:

  • All Doctrine interactions are properly abstracted through interfaces
  • No direct ORM version-specific functionality is used
  • Existing tests use mocked interfaces that remain stable across ORM versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check test coverage for Doctrine ORM functionality
# Expected: Identify areas that need additional testing for ORM 3

echo "Checking test files for Doctrine ORM usage..."
rg -l "doctrine" "test/" "spec/" || true

echo -e "\nChecking for Doctrine-specific test cases..."
rg -l "EntityManager|ObjectManager|ClassMetadata" "test/" "spec/" || true

Length of output: 496


Script:

#!/bin/bash
# First, verify the structure and test directories
echo "Checking bundle structure..."
ls -la src/Sylius/Bundle/OrderBundle/

echo -e "\nChecking composer.json for doctrine/orm..."
cat src/Sylius/Bundle/OrderBundle/composer.json | grep -A 2 -B 2 "doctrine/orm"

echo -e "\nSearching for Doctrine usage in tests (if they exist)..."
rg -l "doctrine|EntityManager|ObjectManager|ClassMetadata" src/Sylius/Bundle/OrderBundle/Tests/ src/Sylius/Bundle/OrderBundle/spec/ || true

Length of output: 2690


Script:

#!/bin/bash
echo "Checking Doctrine usage in spec files..."
cat src/Sylius/Bundle/OrderBundle/spec/Resetter/CartChangesResetterSpec.php
echo -e "\n---\n"
cat src/Sylius/Bundle/OrderBundle/spec/Remover/ExpiredCartsRemoverSpec.php

echo -e "\n\nChecking Tests directory for Doctrine integration tests..."
find src/Sylius/Bundle/OrderBundle/Tests -type f -name "*Test.php" -exec grep -l "doctrine\|EntityManager\|ObjectManager" {} \;

Length of output: 6051

"stof/doctrine-extensions-bundle": "^1.12",
"sylius/addressing": "^2.0",
"sylius/resource-bundle": "^1.12",
"sylius/resource-bundle": "^1.13@alpha",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Fix duplicate conflict entry and consider documenting conflicts

  • The conflict with phpstan/phpdoc-parser >= 2.0 appears consistently across multiple bundles, suggesting it's an intentional constraint
  • There's a syntax error in src/Sylius/Bundle/InventoryBundle/composer.json where the conflict is listed twice
  • Consider documenting the reason for this conflict in the project's documentation, as PHPStan is now the primary static analysis tool
🔗 Analysis chain

Review remaining package conflicts.

While the doctrine/orm conflict has been removed, there's still a conflict with phpstan/phpdoc-parser >= 2.0. Consider:

  • Reviewing if this conflict is still necessary
  • Documenting the reason for the conflict in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for phpstan conflicts across bundles
rg '"phpstan/phpdoc-parser":\s*">= 2.0"'

Length of output: 578


Script:

#!/bin/bash
# Check for documentation about phpstan conflicts
echo "=== Searching in README files ==="
fd -g "*README*" -X grep -l -i "phpstan"

echo -e "\n=== Searching in docs ==="
fd -g "*.md" -t f -d 2 docs/ -X grep -l -i "phpstan"

echo -e "\n=== Searching for upgrade notes ==="
fd -g "UPGRADE*" -X grep -l -i "phpstan"

echo -e "\n=== Checking composer.json descriptions ==="
fd composer.json -X grep -A 1 -B 1 "phpstan/phpdoc-parser"

Length of output: 1721


Script:

#!/bin/bash
# Check UPGRADE-2.0.md for phpstan-related information
echo "=== Checking UPGRADE-2.0.md for phpstan mentions ==="
grep -A 5 -B 5 -i "phpstan" UPGRADE-2.0.md

echo -e "\n=== Checking for duplicate conflict in InventoryBundle ==="
cat src/Sylius/Bundle/InventoryBundle/composer.json

Length of output: 3362

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 17, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/Sylius/Bundle/InventoryBundle/composer.json (1)

36-37: ⚠️ Potential issue

Remove duplicate conflict declaration.

The phpstan/phpdoc-parser conflict is declared twice, which is invalid JSON syntax.

Apply this fix:

    "conflict": {
-       "phpstan/phpdoc-parser": ">= 2.0"
        "phpstan/phpdoc-parser": ">= 2.0"
    },
🧰 Tools
🪛 Biome (1.9.4)

[error] 37-37: expected , but instead found "phpstan/phpdoc-parser"

Remove "phpstan/phpdoc-parser"

(parse)


[error] 36-36: The key phpstan/phpdoc-parser was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

🧹 Nitpick comments (1)
src/Sylius/Bundle/InventoryBundle/composer.json (1)

35-38: LGTM: Removal of doctrine/orm conflict supports ORM 3 testing.

The removal of the doctrine/orm conflict constraint aligns with the PR objective to test support for Doctrine ORM 3.

This change is part of a broader strategy to test compatibility with newer Doctrine ORM versions across all Sylius bundles.

🧰 Tools
🪛 Biome (1.9.4)

[error] 37-37: expected , but instead found "phpstan/phpdoc-parser"

Remove "phpstan/phpdoc-parser"

(parse)


[error] 36-36: The key phpstan/phpdoc-parser was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 154b210 and 89ab9c5.

⛔ Files ignored due to path filters (1)
  • symfony.lock is excluded by !**/*.lock
📒 Files selected for processing (38)
  • composer.json (2 hunks)
  • src/Sylius/Bundle/AddressingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ChannelBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CoreBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CurrencyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CustomerBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/InventoryBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/MoneyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/OrderBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PaymentBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PayumBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ProductBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PromotionBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ShippingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxationBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxonomyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/UserBundle/composer.json (1 hunks)
  • src/Sylius/Component/Addressing/composer.json (1 hunks)
  • src/Sylius/Component/Attribute/composer.json (1 hunks)
  • src/Sylius/Component/Channel/composer.json (1 hunks)
  • src/Sylius/Component/Core/composer.json (1 hunks)
  • src/Sylius/Component/Currency/composer.json (1 hunks)
  • src/Sylius/Component/Customer/composer.json (1 hunks)
  • src/Sylius/Component/Inventory/composer.json (1 hunks)
  • src/Sylius/Component/Locale/composer.json (1 hunks)
  • src/Sylius/Component/Order/composer.json (1 hunks)
  • src/Sylius/Component/Payment/composer.json (1 hunks)
  • src/Sylius/Component/Product/composer.json (1 hunks)
  • src/Sylius/Component/Promotion/composer.json (1 hunks)
  • src/Sylius/Component/Review/composer.json (1 hunks)
  • src/Sylius/Component/Shipping/composer.json (1 hunks)
  • src/Sylius/Component/Taxation/composer.json (1 hunks)
  • src/Sylius/Component/Taxonomy/composer.json (1 hunks)
  • src/Sylius/Component/User/composer.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (37)
  • src/Sylius/Component/Payment/composer.json
  • src/Sylius/Component/Shipping/composer.json
  • src/Sylius/Component/Attribute/composer.json
  • src/Sylius/Component/Channel/composer.json
  • src/Sylius/Component/Product/composer.json
  • src/Sylius/Bundle/PayumBundle/composer.json
  • src/Sylius/Component/Promotion/composer.json
  • src/Sylius/Component/Order/composer.json
  • src/Sylius/Bundle/PaymentBundle/composer.json
  • src/Sylius/Component/User/composer.json
  • src/Sylius/Component/Review/composer.json
  • src/Sylius/Component/Taxonomy/composer.json
  • src/Sylius/Component/Inventory/composer.json
  • src/Sylius/Component/Customer/composer.json
  • src/Sylius/Bundle/CustomerBundle/composer.json
  • src/Sylius/Bundle/UserBundle/composer.json
  • src/Sylius/Component/Addressing/composer.json
  • src/Sylius/Component/Locale/composer.json
  • src/Sylius/Component/Core/composer.json
  • src/Sylius/Bundle/AddressingBundle/composer.json
  • src/Sylius/Bundle/ShippingBundle/composer.json
  • src/Sylius/Component/Taxation/composer.json
  • src/Sylius/Bundle/ProductBundle/composer.json
  • src/Sylius/Bundle/TaxonomyBundle/composer.json
  • src/Sylius/Bundle/CurrencyBundle/composer.json
  • src/Sylius/Bundle/MoneyBundle/composer.json
  • src/Sylius/Component/Currency/composer.json
  • src/Sylius/Bundle/LocaleBundle/composer.json
  • src/Sylius/Bundle/TaxationBundle/composer.json
  • src/Sylius/Bundle/PromotionBundle/composer.json
  • src/Sylius/Bundle/AttributeBundle/composer.json
  • composer.json
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/ReviewBundle/composer.json
  • src/Sylius/Bundle/ChannelBundle/composer.json
  • src/Sylius/Bundle/CoreBundle/composer.json
  • src/Sylius/Bundle/OrderBundle/composer.json
🧰 Additional context used
🪛 Biome (1.9.4)
src/Sylius/Bundle/InventoryBundle/composer.json

[error] 36-36: The key phpstan/phpdoc-parser was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

"php": "^8.2",
"sylius/inventory": "^2.0",
"sylius/resource-bundle": "^1.12",
"sylius/resource-bundle": "^1.13@alpha",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Version constraint is consistent, but composer.json has syntax error

The sylius/resource-bundle: ^1.13@alpha version constraint is consistent across all bundles. However, there's a syntax error in the composer.json file:

  • Duplicate and malformed conflict entry for phpstan/phpdoc-parser at line 37
🔗 Analysis chain

Verify consistent version constraints across bundles.

The update to sylius/resource-bundle: ^1.13@alpha aligns with the PR objective. Let's verify this change is consistent across all bundles.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for inconsistent sylius/resource-bundle versions across bundles
# Expected: All should use ^1.13@alpha

# Search for sylius/resource-bundle version constraints in all composer.json files
find src/Sylius/Bundle -name composer.json -exec grep -l "sylius/resource-bundle" {} \; | while read -r file; do
    echo "=== $file ==="
    jq '.require["sylius/resource-bundle"]' "$file"
done

Length of output: 4606


Script:

#!/bin/bash
# Check the content of InventoryBundle's composer.json
cat src/Sylius/Bundle/InventoryBundle/composer.json

Length of output: 2122

@loic425 loic425 force-pushed the orm-3 branch 3 times, most recently from 6b54bdf to b88c969 Compare January 20, 2025 07:57
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php (1)

Line range hint 25-149: Overall assessment: Clean migration to TokenType constants.

The changes consistently migrate all token type checks from Lexer to TokenType constants while maintaining the same functionality. This update aligns well with the PR objective of supporting Doctrine ORM 3.

Consider adding a test that specifically exercises these JSON function nodes with Doctrine ORM 3 to ensure compatibility.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b54bdf and b88c969.

⛔ Files ignored due to path filters (1)
  • symfony.lock is excluded by !**/*.lock
📒 Files selected for processing (41)
  • composer.json (2 hunks)
  • src/Sylius/Bundle/AddressingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ChannelBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceDeleteHandler.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/composer.json (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (1 hunks)
  • src/Sylius/Bundle/CurrencyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/CustomerBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/InventoryBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/MoneyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/OrderBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PaymentBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PayumBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php (6 hunks)
  • src/Sylius/Bundle/ProductBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/PromotionBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/ShippingBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxationBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/TaxonomyBundle/composer.json (1 hunks)
  • src/Sylius/Bundle/UserBundle/composer.json (1 hunks)
  • src/Sylius/Component/Addressing/composer.json (1 hunks)
  • src/Sylius/Component/Attribute/composer.json (1 hunks)
  • src/Sylius/Component/Channel/composer.json (1 hunks)
  • src/Sylius/Component/Core/composer.json (2 hunks)
  • src/Sylius/Component/Currency/composer.json (1 hunks)
  • src/Sylius/Component/Customer/composer.json (1 hunks)
  • src/Sylius/Component/Inventory/composer.json (1 hunks)
  • src/Sylius/Component/Locale/composer.json (1 hunks)
  • src/Sylius/Component/Order/composer.json (1 hunks)
  • src/Sylius/Component/Payment/composer.json (1 hunks)
  • src/Sylius/Component/Product/composer.json (1 hunks)
  • src/Sylius/Component/Promotion/composer.json (1 hunks)
  • src/Sylius/Component/Review/composer.json (1 hunks)
  • src/Sylius/Component/Shipping/composer.json (1 hunks)
  • src/Sylius/Component/Taxation/composer.json (1 hunks)
  • src/Sylius/Component/Taxonomy/composer.json (1 hunks)
  • src/Sylius/Component/User/composer.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceDeleteHandler.php
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
🚧 Files skipped from review as they are similar to previous changes (38)
  • src/Sylius/Bundle/ReviewBundle/composer.json
  • src/Sylius/Component/User/composer.json
  • src/Sylius/Component/Order/composer.json
  • src/Sylius/Component/Locale/composer.json
  • src/Sylius/Component/Payment/composer.json
  • src/Sylius/Component/Customer/composer.json
  • src/Sylius/Bundle/PayumBundle/composer.json
  • src/Sylius/Component/Review/composer.json
  • src/Sylius/Component/Taxation/composer.json
  • src/Sylius/Component/Currency/composer.json
  • src/Sylius/Component/Promotion/composer.json
  • src/Sylius/Component/Taxonomy/composer.json
  • src/Sylius/Component/Shipping/composer.json
  • src/Sylius/Bundle/ProductBundle/composer.json
  • src/Sylius/Component/Product/composer.json
  • src/Sylius/Component/Channel/composer.json
  • src/Sylius/Component/Attribute/composer.json
  • src/Sylius/Bundle/CoreBundle/composer.json
  • src/Sylius/Bundle/AttributeBundle/composer.json
  • src/Sylius/Bundle/ShippingBundle/composer.json
  • src/Sylius/Bundle/UserBundle/composer.json
  • src/Sylius/Bundle/PaymentBundle/composer.json
  • src/Sylius/Component/Core/composer.json
  • src/Sylius/Component/Addressing/composer.json
  • composer.json
  • src/Sylius/Bundle/OrderBundle/composer.json
  • src/Sylius/Bundle/CurrencyBundle/composer.json
  • src/Sylius/Bundle/CustomerBundle/composer.json
  • src/Sylius/Bundle/TaxonomyBundle/composer.json
  • src/Sylius/Component/Inventory/composer.json
  • src/Sylius/Bundle/MoneyBundle/composer.json
  • src/Sylius/Bundle/PromotionBundle/composer.json
  • src/Sylius/Bundle/ChannelBundle/composer.json
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/AddressingBundle/composer.json
  • src/Sylius/Bundle/InventoryBundle/composer.json
  • src/Sylius/Bundle/LocaleBundle/composer.json
  • src/Sylius/Bundle/TaxationBundle/composer.json
🔇 Additional comments (7)
src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php (7)

25-25: LGTM: TokenType import added correctly.

The addition of the TokenType import aligns with the migration from Lexer constants to TokenType constants.


59-60: LGTM: Token type constants updated correctly.

The migration from Lexer to TokenType constants is done correctly for the parse method's token matching.

Also applies to: 68-68


76-79: LGTM: Optional arguments parsing updated correctly.

Token type checks have been properly migrated to use TokenType constants while maintaining the same logic.


92-92: LGTM: Arguments parsing token updated correctly.

The comma token check has been properly migrated to use TokenType.


117-117: LGTM: String literal parsing updated correctly.

The string token type check has been properly migrated to use TokenType.


133-138: LGTM: Alphanumeric literal parsing updated correctly.

All token type checks for string, integer, and float have been properly migrated to use TokenType constants while maintaining the same logic flow.


149-149: LGTM: String literal matching updated correctly.

The string token matching has been properly migrated to use TokenType.

Let's verify that all Lexer token type constants have been migrated:

✅ Verification successful

Token type migration verified successfully

All token matching operations in the file consistently use TokenType constants, with no remaining Lexer constants.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify complete migration from Lexer to TokenType constants
# Check for any remaining Lexer token type constants that might have been missed

rg "Lexer::T_" "src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php"

Length of output: 107


Script:

#!/bin/bash
# Check for TokenType usage and other token matching patterns
rg "TokenType::T_" "src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php"

# Also check for any direct token matching without constants
rg "match\(" "src/Sylius/Bundle/ProductBundle/Doctrine/ORM/Query/AST/Function/AbstractJsonFunctionNode.php"

Length of output: 1256

@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Jan 23, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b88c969 and dd04607.

📒 Files selected for processing (12)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
🧰 Additional context used
🪛 phpstan (2.0.3)
src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php

25-25: Method Sylius\Bundle\CoreBundle\Remover\ReviewerReviewsRemover::__construct() has parameter $reviewRepository with generic interface Sylius\Resource\Doctrine\Persistence\RepositoryInterface but does not specify its types: T

(missingType.generics)

🔇 Additional comments (13)
src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (3)

22-22: LGTM! Good use of interface instead of concrete class.

The change to import OrderItemRepositoryInterface instead of OrderItemRepository follows SOLID principles by depending on abstractions rather than concrete implementations.


Line range hint 30-38: LGTM! Constructor properly uses the interface type.

The constructor parameter type has been correctly updated to use OrderItemRepositoryInterface, maintaining consistency with the import change while preserving the dependency injection pattern.


42-42: LGTM! Test methods consistently use the interface type.

All test methods have been properly updated to use OrderItemRepositoryInterface. The changes maintain the same test coverage while improving the code by:

  • Using interface types consistently throughout the spec
  • Preserving all test scenarios (success case and error cases)
  • Following best practices for dependency injection

Also applies to: 62-62, 82-82

src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1)

20-20: LGTM! Good move towards interface-based design.

The change from EntityRepository to RepositoryInterface aligns well with dependency inversion principles, making the code more flexible and easier to test.

Also applies to: 28-28

src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1)

18-18: LGTM! Good abstraction improvement.

Switching to Doctrine\Persistence\Event\LifecycleEventArgs aligns with Doctrine's best practices by depending on the persistence abstraction rather than the concrete ORM implementation. This change supports both Doctrine ORM 2 and 3 compatibility.

src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1)

16-16: LGTM! Consistent with other spec files.

The change to use Doctrine\Persistence\Event\LifecycleEventArgs maintains consistency with other spec files and supports the transition to Doctrine ORM 3 while preserving backward compatibility.

src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3)

17-19: LGTM! Required imports for Doctrine ORM 3 support.

The new imports align with Doctrine ORM's persistence approach, supporting both ORM 2 and 3.


52-63: LGTM! Updated test to support Doctrine ORM 3's persistence approach.

The changes properly adapt the test to work with both Doctrine ORM 2 and 3:

  1. Repository initialization using ClassMetadata
  2. Entity persistence using UnitOfWork and EntityPersister
  3. Proper entity loading with explicit parameters

87-98: LGTM! Consistent implementation with the previous test method.

The changes mirror the updates in the previous test method, maintaining consistency in the testing approach across Doctrine ORM versions.

src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (4)

19-19: LGTM! Updated to use Doctrine ORM's ClassMetadata.

Properly imports ClassMetadata which is compatible with both Doctrine ORM 2 and 3.


63-66: LGTM! Updated method signature for Doctrine ORM 3 compatibility.

Properly updates type hints from ClassMetadataInfo to ClassMetadata to support both ORM versions.


71-77: LGTM! Proper metadata handling for Doctrine ORM 3.

The changes correctly:

  1. Set up fieldMappings on ClassMetadata
  2. Update getMetadataFor calls to work with the new metadata structure

113-113: LGTM! Consistent type hint updates across test methods.

All test methods are consistently updated to use ClassMetadata instead of ClassMetadataInfo.

Also applies to: 132-132, 149-149

use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderSequenceInterface;
use Sylius\Resource\Doctrine\Persistence\RepositoryInterface;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add generic type parameter for consistency.

The change to RepositoryInterface is good, but for consistency with other files and better type safety, we should specify the generic type parameter.

-RepositoryInterface $sequenceRepository,
+RepositoryInterface<OrderSequenceInterface> $sequenceRepository,

Also applies to: 28-28, 41-41, 58-58

final readonly class ReviewChangeListener
{
public function __construct(private readonly ReviewableRatingUpdaterInterface $averageRatingUpdater)
public function __construct(private ReviewableRatingUpdaterInterface $averageRatingUpdater)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider maintaining readonly property with readonly class.

The class is marked as final readonly but the property has been changed from readonly to mutable. Since the property is only set in the constructor and never modified afterwards, it should remain readonly to maintain consistency with the class modifier and ensure immutability.

-    public function __construct(private ReviewableRatingUpdaterInterface $averageRatingUpdater)
+    public function __construct(private readonly ReviewableRatingUpdaterInterface $averageRatingUpdater)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public function __construct(private ReviewableRatingUpdaterInterface $averageRatingUpdater)
public function __construct(private readonly ReviewableRatingUpdaterInterface $averageRatingUpdater)

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (1)

1-186: Consider documenting the expression type requirements.

These changes form part of a systematic update to use more specific Doctrine expression types (Expr\Comparison, Expr\Andx, Expr\Orx) across all query extensions. Consider adding documentation about these type requirements to help future contributors maintain consistency.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (1)

1-1: Architectural improvements for Doctrine ORM 3.0 support.

The changes across these spec files demonstrate a systematic improvement in query building:

  1. Using correct expression types (Expr\Comparison for equality, Expr\Func for IN clauses)
  2. Proper parameter handling with explicit setParameter calls
  3. Consistent approach across different query extensions

These changes enhance type safety and maintainability while ensuring compatibility with Doctrine ORM 3.0.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e9cd82b and 0d5d780.

📒 Files selected for processing (21)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php
🔇 Additional comments (10)
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (1)

85-87: LGTM! Improved type safety in expression handling.

The changes enhance type safety by using specific expression types (Expr\Comparison, Expr\Andx, Expr\Orx) instead of the generic Expr\Func. This better reflects Doctrine ORM's type system and makes the test more precise.

Also applies to: 100-106

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (1)

69-69: LGTM! Consistent type safety improvement.

The update to use Expr\Comparison instead of Expr\Func for equality and inequality expressions aligns with Doctrine's type system and matches the improvements made in other files.

Also applies to: 127-127

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (1)

71-71: LGTM! Improved naming and type safety.

The changes enhance both type safety and code clarity by:

  1. Using the more specific Expr\Comparison type
  2. Renaming exprEq to exprComparison for better clarity

Also applies to: 81-82, 122-122, 133-134

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (1)

143-143: LGTM! Parameter handling improvement.

The addition of explicit parameter setting using setParameter is a good practice that enhances security and type safety.

Also applies to: 180-180

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (1)

130-130: LGTM! Improved expression type for IN clause.

The change to use Expr\Func for the IN clause is correct and aligns with Doctrine's expression handling. The parameter setting is also properly implemented.

Also applies to: 144-145, 169-169, 183-184

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (1)

103-103: LGTM! Correct expression type for equality checks.

The change to use Expr\Comparison for equality checks is appropriate and aligns with Doctrine's expression handling for simple equality conditions.

Also applies to: 113-114, 183-183

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (1)

104-104: LGTM! Consistent expression type usage.

The change to use Expr\Comparison for equality checks is consistent with other files and correctly represents the equality operation in Doctrine.

Also applies to: 116-117, 187-187, 199-200

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (3)

86-88: LGTM! Enhanced type safety with specific expression types.

The addition of typed expression parameters (Expr\Comparison, Expr\Andx, Expr\Orx) aligns with Doctrine ORM 3's more type-safe approach to query building.


103-110: LGTM! Improved expression handling for Doctrine ORM 3.

The changes properly reflect Doctrine ORM 3's expression handling:

  • String representations for NULL checks
  • Typed expressions for equality and logical combinations
  • Proper chaining of conditions using typed expressions

164-166: LGTM! Consistent expression handling in item tests.

The changes maintain consistency with the collection method's updates, ensuring proper testing of Doctrine ORM 3's expression handling for both collection and item queries.

Also applies to: 181-188


$queryBuilder->innerJoin('o.customer', 'customer')->willReturn($queryBuilder);
$queryBuilder->andWhere($exprComparison)->willReturn($queryBuilder);
$queryBuilder->setParameter(':customer', $customer)->willReturn($queryBuilder);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fixed missing parameter binding in query builder.

Added the missing setParameter calls for the customer parameter in both collection and item methods. This is an important fix as the query would fail without properly bound parameters.

Also applies to: 179-179

@loic425 loic425 force-pushed the orm-3 branch 3 times, most recently from e3184f8 to 1e91d2e Compare February 5, 2025 07:31
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (1)

85-107: Excellent improvement in expression type handling!

The transition from generic Expr\Func to specific expression types (Expr\Comparison, Expr\Andx, Expr\Orx) enhances type safety and makes the SQL condition handling more explicit and maintainable.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1763eac and 1e91d2e.

📒 Files selected for processing (27)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (18)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
🔇 Additional comments (13)
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1)

67-67: LGTM! Proper method chaining in test expectations.

The addition of willReturn($queryBuilder) correctly reflects the fluent interface pattern used by Doctrine's QueryBuilder, ensuring that method chaining works as expected in the test.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1)

66-66: LGTM! Improved test accuracy for QueryBuilder's fluent interface.

The change correctly reflects QueryBuilder's method chaining behavior by expecting andWhere() to return the builder instance. This matches Doctrine ORM's fluent interface pattern and ensures the test accurately represents the API's behavior.

src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (2)

17-19: LGTM! New imports align with Doctrine ORM 3 support.

The addition of Doctrine ORM classes aligns with the PR objective of testing Doctrine ORM 3 support.


46-79: LGTM! Test refactoring maintains behavior while supporting Doctrine ORM 3.

The changes effectively adapt the tests to use Doctrine ORM 3's EntityPersister while maintaining the original test behavior and assertions. The implementation is consistent across both test methods and follows PHPSpec patterns.

Also applies to: 81-114

src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (4)

20-20: LGTM! Good architectural improvement.

Switching from concrete EntityRepository to RepositoryInterface reduces coupling to Doctrine ORM specifics and improves code flexibility.


25-25: LGTM! Improved test flexibility.

Using RepositoryInterface in the test setup allows for better test isolation and flexibility.


35-39: LGTM! Consistent interface usage.

The change maintains test behavior while using the more abstract interface type.


48-53: LGTM! Consistent interface usage.

The change maintains test behavior while using the more abstract interface type.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1)

73-73: LGTM! Improved method chaining support in test.

The change correctly mocks the fluent interface pattern used by Doctrine's query builder.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1)

95-95: LGTM! Corrected return type for getRootAliases().

The change properly reflects that getRootAliases() should return an array of aliases, not a single string.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (1)

86-189: LGTM! Consistent improvement in expression handling.

The changes maintain consistency with other specs by:

  1. Using specific expression types (Expr\Comparison, Expr\Andx, Expr\Orx)
  2. Making SQL conditions more explicit
  3. Applying the improvements consistently across both collection and item methods
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2)

85-85: LGTM! Type hint updated for Doctrine ORM 3 compatibility.

The type hint change from Expr\Comparison to Expr\Func correctly reflects Doctrine ORM 3's expression handling.


102-103: LGTM! Expression handling updated for Doctrine ORM 3.

The changes correctly adapt to Doctrine ORM 3's expression handling:

  • andX now expects an Expr\Func for the IN condition
  • in method now returns Expr\Func instead of Expr\Comparison

Let's verify the Doctrine ORM 3 changes:

✅ Verification successful

🌐 Web query:

What are the breaking changes in Doctrine ORM 3 regarding expression handling?

Length of output: 5515


LGTM: Doctrine ORM 3 expression updates verified.

The updated test expectations align with the documented breaking changes:

  • andX now expects an Expr\Func for the IN condition.
  • The in method is expected to return an expression function (instead of the legacy Expr\Comparison).

These changes are consistent with the Doctrine ORM 3 BC breaks regarding custom SQL walkers and IN expression restructuring.

@loic425 loic425 changed the title Test support for Doctrine ORM 3 Add support for Doctrine ORM 3 Feb 5, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (1)

133-134: Remove commented out code.

These lines are no longer needed as the implementation has been updated to use EntityPersister.

-        // $entityManager->getRepository(get_class($parentItem))->willReturn($repository);
-        //$repository->findOneBy(['code' => 'value'])->willReturn($parentItem);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e91d2e and e494560.

📒 Files selected for processing (29)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (4 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (26)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php
🔇 Additional comments (9)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (3)

19-21: LGTM! Import statements align with Doctrine ORM 3 support.

The new imports correctly reflect the transition to using Doctrine ORM's lower-level APIs.

Also applies to: 25-25


87-88: LGTM! Test correctly uses updated Doctrine ORM APIs.

The changes properly adapt the test to use UnitOfWork and EntityPersister while maintaining the same test behavior.

Also applies to: 101-107


118-128: LGTM! Test correctly uses updated Doctrine ORM APIs.

The changes properly adapt the test to use UnitOfWork and EntityPersister while maintaining the same test behavior.

Also applies to: 130-130

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (3)

85-87: LGTM! Enhanced type safety with specific expression types.

The change from generic Expr\Func to specific expression types (Comparison, Andx, Orx) improves type safety and makes the code more maintainable.


100-106: LGTM! Improved readability with string literals for SQL conditions.

Using string literals for SQL conditions ('user IS NULL', etc.) instead of expression objects makes the code more readable and easier to understand.


107-107: LGTM! Better composition of complex conditions.

The change to use andWhere with $exprOrx maintains the same logical conditions while providing better type safety and readability.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (3)

86-88: LGTM! Consistent use of specific expression types.

The changes maintain consistency with the Order spec by using the same specific expression types.


103-108: LGTM! Clear and readable SQL condition building.

The string literals for SQL conditions make the query building process more transparent and maintainable.


181-187: LGTM! Consistent implementation across methods.

The changes in it_applies_conditions_to_item mirror those in it_applies_conditions_to_collection, maintaining consistency throughout the codebase.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (1)

21-22: Remove unused import.

The AbstractQuery import is no longer used after changing the type hint to Query.

-use Doctrine\ORM\AbstractQuery;
 use Doctrine\ORM\Query;
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (1)

113-136: Remove commented-out code.

The test changes look good, but there are commented-out lines that should be removed for code cleanliness.

Apply this diff to clean up the code:

-        // $entityManager->getRepository(get_class($parentItem))->willReturn($repository);
-        //$repository->findOneBy(['code' => 'value'])->willReturn($parentItem);
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (1)

103-110: LGTM! More explicit and maintainable SQL expression handling.

The new approach using string literals and structured composition with andX/orX improves readability and better reflects Doctrine's query building.

Consider extracting the SQL condition strings to constants for better maintainability:

+    private const USER_IS_NULL = 'user IS NULL';
+    private const USER_IS_NOT_NULL = 'user IS NOT NULL';
+    private const CUSTOMER_IS_NULL = 'order.customer IS NULL';
+
     function it_applies_conditions_to_collection(
         // ...
     ): void {
         // ...
-        $expr->isNull('user')->willReturn('user IS NULL');
-        $expr->isNull('order.customer')->willReturn('order.customer IS NULL');
-        $expr->isNotNull('user')->willReturn('user IS NOT NULL');
+        $expr->isNull('user')->willReturn(self::USER_IS_NULL);
+        $expr->isNull('order.customer')->willReturn(self::CUSTOMER_IS_NULL);
+        $expr->isNotNull('user')->willReturn(self::USER_IS_NOT_NULL);

Also applies to: 181-188

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e494560 and e4cc0d4.

📒 Files selected for processing (30)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (2 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (3 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (26)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Static checks / PHP 8.2, Symfony ^6.4
🔇 Additional comments (8)
src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (1)

97-97: LGTM! Type hint change aligns with Doctrine ORM 3.

The change from AbstractQuery to Query is appropriate as it:

  • Maintains backward compatibility (Query extends AbstractQuery)
  • Provides a more specific type hint
  • Aligns with Doctrine ORM 3 changes
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (2)

19-21: LGTM! Imports reflect the transition to using Doctrine ORM components.

The new imports align with the architectural shift from using repository interface to using lower-level Doctrine ORM components (UnitOfWork and EntityPersister).

Also applies to: 25-25


83-111: LGTM! Test method updated to use lower-level Doctrine ORM components.

The changes improve the test by:

  • Using UnitOfWork and EntityPersister for more granular control over entity loading
  • Better reflecting the actual implementation details
  • Maintaining clean code by removing commented-out code
src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (1)

86-88: LGTM! Improved type safety with specific Doctrine expression types.

The change from generic Expr\Func to specific expression types (Comparison, Andx, Orx) aligns well with Doctrine ORM 3's type system and improves the test's precision.

Also applies to: 164-166

src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (4)

19-19: LGTM! Import updated for Doctrine ORM 3 compatibility.

The change from ClassMetadataInfo to ClassMetadata aligns with Doctrine ORM 3's class structure.


63-66: LGTM! Method signatures updated for Doctrine ORM 3 compatibility.

Type hints consistently updated from ClassMetadataInfo to ClassMetadata across all test methods, maintaining the same behavior while ensuring compatibility with Doctrine ORM 3.

Also applies to: 113-113, 132-132, 149-149


71-77: LGTM! Implementation updated for Doctrine ORM 3 compatibility.

The changes correctly adapt the test implementation to work with Doctrine ORM 3's API:

  • Field mappings access updated to use the fieldMappings property
  • Mock setup properly configured to return ClassMetadata instances

1-164: Verify corresponding changes in the implementation class.

The test changes look good, but let's verify that the corresponding implementation class (LoadMetadataSubscriber) has been updated with matching changes.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Check if the implementation class has matching changes
rg -A 5 "use Doctrine\\ORM\\Mapping\\ClassMetadata" "src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php"
rg -A 5 "ClassMetadata \\\$metadata" "src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php"

Length of output: 731


Implementation class update verified.

The implementation in LoadMetadataSubscriber.php includes early returns checking for existing "subject" and "attribute" associations—matching the expectations in the spec. The conditions:

  • if ($metadata->hasAssociation('subject')) { return; }
  • if ($metadata->hasAssociation('attribute')) { return; }

confirm that when associations already exist, no additional mapping is applied. This behavior is consistent with the test scenarios defined in the spec.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (3)

83-111: LGTM! Consider adding test coverage for different criteria.

The changes correctly implement entity loading using UnitOfWork and EntityPersister while maintaining the same test behavior. However, consider adding test cases for different criteria beyond just the 'code' field to ensure robust handling of various lookup scenarios.


132-133: Remove commented-out code.

The old repository-based implementation is commented out and should be removed as it's no longer needed.

-        // $entityManager->getRepository(get_class($parentItem))->willReturn($repository);
-        //$repository->findOneBy(['code' => 'value'])->willReturn($parentItem);

113-136: LGTM! Consider adding test coverage for edge cases.

The changes correctly implement entity loading using UnitOfWork and EntityPersister. Consider adding test cases for:

  1. Multiple criteria in the load parameters
  2. Different parameter types beyond strings
  3. Error conditions from the EntityPersister
src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (2)

42-88: Consider enhancing test readability and maintainability.

The switch to QueryBuilder is a good modernization, but consider these improvements:

  1. Extract the JSON key to a constant for better maintainability
  2. Add expectations for the actual query structure being built
 final class SelectProductAttributeChoiceRemoveListenerSpec extends ObjectBehavior
 {
+    private const REMOVED_CHOICE_KEY = '1739bc61-9e42-4c80-8b9a-f97f0579cccb';
+
     function let(): void
     {
         $this->beConstructedWith(ProductAttributeValue::class);
     }

     function it_removes_select_product_attribute_choices(
         LifecycleEventArgs $event,
         EntityManagerInterface $entityManager,
         ProductAttributeInterface $productAttribute,
         ProductAttributeValueInterface $productAttributeValue,
         QueryBuilder $queryBuilder,
         Connection $connection,
         Query $query,
     ): void {
         // ... existing setup ...

         $queryBuilder->select('o')->shouldBeCalled()->willReturn($queryBuilder);
         $queryBuilder->from(ProductAttributeValue::class, 'o')->shouldBeCalled()->willReturn($queryBuilder);
-        $queryBuilder->andWhere(Argument::type('string'))->shouldBeCalled()->willReturn($queryBuilder);
-        $queryBuilder->setParameter('key', '%"1739bc61-9e42-4c80-8b9a-f97f0579cccb"%')->shouldBeCalled()->willReturn($queryBuilder);
+        $queryBuilder->andWhere('JSON_SEARCH(o.json, \'one\', :key) IS NOT NULL')->shouldBeCalled()->willReturn($queryBuilder);
+        $queryBuilder->setParameter('key', '%"' . self::REMOVED_CHOICE_KEY . '"%')->shouldBeCalled()->willReturn($queryBuilder);

56-57: Consider using a mock repository instead of a real one.

Creating a real repository instance in a spec test might introduce unnecessary complexity. Consider using a mock repository instead for better isolation and control over the test behavior.

-        $productAttributeValueRepository = new ProductAttributeValueRepository($entityManager->getWrappedObject(), new ClassMetadata('Sylius\Component\Product\Model\ProductAttributeValue'));
+        $productAttributeValueRepository = Mockery::mock(ProductAttributeValueRepository::class);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4cc0d4 and 7868162.

📒 Files selected for processing (31)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (2 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/ORM/SqlWalker/OrderByIdentifierSqlWalker.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (3 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (26)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: Frontend / NodeJS 20.x
  • GitHub Check: Packages / PHP 8.3, Symfony ^7.1
  • GitHub Check: Packages / PHP 8.2, Symfony ^6.4
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.3, Symfony ^7.1, PostgreSQL 16.4
  • GitHub Check: End-to-end tests (PostgreSQL) / Non-JS, PHP 8.2, Symfony ^6.4, PostgreSQL 15.8
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter winzou_state_machine
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.3, Symfony ^7.1, MariaDB 11.4.3, State Machine Adapter symfony_workflow
  • GitHub Check: End-to-end tests (MariaDB) / Non-JS, PHP 8.2, Symfony ^6.4, MariaDB 10.11.9, State Machine Adapter symfony_workflow
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Panther, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.3, Symfony ^7.1 (test_cached), MySQL 8.4, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / JS with Chromedriver, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
  • GitHub Check: End-to-end tests (MySQL) / Non-JS, PHP 8.2, Symfony ^6.4 (test_cached), MySQL 8.0, Twig ^3.3
🔇 Additional comments (9)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (1)

19-21: LGTM! Import changes align with Doctrine ORM 3 support.

The new imports correctly reflect the transition from using the high-level repository interface to using lower-level Doctrine ORM components.

Also applies to: 25-25

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (3)

85-87: LGTM! Improved type safety with specific expression types.

The change from generic Expr\Func to specific expression types (Comparison, Andx, Orx) aligns with Doctrine ORM 3's type system and improves code clarity.


100-106: LGTM! Enhanced SQL expression handling.

The change to return SQL condition strings directly (e.g., 'user IS NULL') instead of expression objects makes the test specifications more explicit and easier to understand.


107-107: LGTM! Improved query building with specific expression types.

Using $exprOrx instead of $exprFunc provides better type safety and clarity about the nature of the condition being applied.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (3)

86-88: LGTM! Consistent type safety improvements.

The changes mirror those in the Order spec, maintaining consistency in the use of specific expression types across the codebase.


103-109: LGTM! Consistent SQL expression handling.

The changes maintain consistency with the Order spec in how SQL conditions are represented, making the test specifications more explicit and maintainable.


181-187: LGTM! Consistent query building improvements.

The changes in the it_applies_conditions_to_item method maintain consistency with the collection handling, ensuring uniform treatment of SQL expressions throughout the codebase.

src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (1)

16-29: LGTM! Import changes align with Doctrine best practices.

The switch to Doctrine\Persistence\Event\LifecycleEventArgs provides better abstraction, and the additional imports support the new QueryBuilder-based implementation.

src/Sylius/Bundle/CoreBundle/Doctrine/ORM/SqlWalker/OrderByIdentifierSqlWalker.php (1)

26-26: LGTM! The return type addition improves type safety.

The addition of the : string return type is a good improvement that:

  • Enhances type safety through explicit typing
  • Maintains backward compatibility
  • Aligns with Doctrine ORM's interface contract

Let's verify the parent method's signature in both Doctrine ORM 2 and 3:

@loic425 loic425 force-pushed the orm-3 branch 2 times, most recently from 7811e35 to 072855d Compare February 7, 2025 08:51
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🧹 Nitpick comments (7)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (2)

113-136: Remove commented out code.

The test has been properly updated to use EntityPersister, but there are commented out lines that should be removed:

-        // $entityManager->getRepository(get_class($parentItem))->willReturn($repository);
-        //$repository->findOneBy(['code' => 'value'])->willReturn($parentItem);

1-138: Well-structured update for Doctrine ORM 3 compatibility.

The changes effectively transition from using RepositoryInterface to Doctrine's lower-level APIs (UnitOfWork and EntityPersister), maintaining test coverage while adapting to the new version's requirements.

Consider documenting these changes in the migration guide to help other developers update their custom implementations that might be using the repository interface directly.

src/Sylius/Behat/Page/Admin/Channel/CreatePage.php (1)

16-16: Consider adding readonly modifier for consistency.

While the changes follow the architectural decision to move the interface, consider adding the readonly modifier to $autocompleteHelper for consistency with other files in the codebase.

-        private AutocompleteHelperInterface $autocompleteHelper,
+        private readonly AutocompleteHelperInterface $autocompleteHelper,

Also applies to: 39-39

src/Sylius/Behat/Page/Admin/Inventory/IndexPage.php (1)

16-16: Consider adding readonly modifier for consistency.

While the changes follow the architectural decision to move the interface, consider adding the readonly modifier to $autocompleteHelper for consistency with other files in the codebase.

-        private AutocompleteHelperInterface $autocompleteHelper,
+        private readonly AutocompleteHelperInterface $autocompleteHelper,

Also applies to: 30-30

src/Sylius/Behat/Page/Admin/Payment/PaymentRequest/IndexPage.php (1)

16-16: Consider keeping test helpers within the Sylius namespace.

Moving AutocompleteHelperInterface from Sylius\Behat\Service\Helper to App\Tests\Behat\Service\Helper reduces reusability of Sylius's test infrastructure. Consider keeping test helpers within the Sylius namespace if they're meant to be reused by other projects using Sylius.

Also applies to: 31-31

src/Sylius/Behat/Page/Admin/Product/CreateSimpleProductPage.php (1)

16-16: Consider using readonly consistently across files.

While the changes look good, there's an inconsistency in the use of the readonly modifier between files. Consider making it consistent across all implementations.

Also applies to: 39-39

src/Sylius/Behat/Element/Admin/Product/MediaFormElement.php (1)

16-16: Consider documenting the namespace reorganization rationale.

The systematic move of test helpers from Sylius\Behat\Service\Helper to App\Tests\Behat\Service\Helper improves the separation of concerns by clearly distinguishing application-specific test helpers from the core Sylius framework. This architectural change enhances maintainability and follows better testing practices.

🛑 Comments failed to post (1)
src/Sylius/Behat/Element/Admin/CatalogPromotion/FormElement.php (1)

16-16: 💡 Verification agent

🧩 Analysis chain

Verify the namespace change impact.

The AutocompleteHelperInterface has been moved from Sylius\Behat\Service\Helper to App\Tests\Behat\Service\Helper. This change might affect other test implementations that depend on this interface.


🏁 Script executed:

#!/bin/bash
# Check for any remaining references to the old namespace
rg "Sylius\\\\Behat\\\\Service\\\\Helper\\\\AutocompleteHelperInterface" -l

Length of output: 873


Namespace inconsistency detected in configuration files.

The PHP file under review now imports the interface as:
  use App\Tests\Behat\Service\Helper\AutocompleteHelperInterface;
However, the shell script shows that several XML configuration files still reference the old namespace (Sylius\Behat\Service\Helper\AutocompleteHelperInterface):

• src/Sylius/Behat/Resources/config/services.xml
• src/Sylius/Behat/Resources/config/services/elements/admin.xml
• src/Sylius/Behat/Resources/config/services/elements/admin/product.xml
• … and others

This discrepancy could lead to dependency injection issues in tests that load these configurations. Please ensure that all configuration references to the old namespace are updated to match the new namespace.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (1)

132-133: Remove commented out code.

The old repository-based implementation can be referenced through Git history if needed.

-        // $entityManager->getRepository(get_class($parentItem))->willReturn($repository);
-        //$repository->findOneBy(['code' => 'value'])->willReturn($parentItem);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7811e35 and 072855d.

📒 Files selected for processing (37)
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php (3 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php (2 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php (1 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (4 hunks)
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php (2 hunks)
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php (3 hunks)
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php (5 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/DateFormat.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Day.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Hour.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Month.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Week.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Year.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/Doctrine/ORM/SqlWalker/OrderByIdentifierSqlWalker.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php (2 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php (1 hunks)
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php (3 hunks)
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php (3 hunks)
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php (3 hunks)
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php (1 hunks)
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php (1 hunks)
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (34)
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Common/NonArchivedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Hour.php
  • src/Sylius/Bundle/ApiBundle/spec/StateProvider/Shop/Product/ProductAttributeValue/CollectionProviderSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/StateBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Product/TaxonBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/ORM/SqlWalker/OrderByIdentifierSqlWalker.php
  • src/Sylius/Bundle/CoreBundle/spec/EventListener/CanonicalizerListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Day.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Address/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ReviewBundle/spec/EventListener/ReviewChangeListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Month.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Taxon/EnabledChildrenExtensionSpec.php
  • src/Sylius/Bundle/UserBundle/spec/EventListener/PasswordUpdaterListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Week.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/Remover/ReviewerReviewsRemover.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/Year.php
  • src/Sylius/Bundle/CoreBundle/spec/Remover/ReviewerReviewsRemoverSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ExchangeRate/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/ProductReview/AcceptedExtensionSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Currency/ChannelBasedExtensionSpec.php
  • src/Sylius/Bundle/ReviewBundle/EventListener/ReviewChangeListener.php
  • src/Sylius/Bundle/AttributeBundle/Doctrine/ORM/Subscriber/LoadMetadataSubscriber.php
  • src/Sylius/Bundle/CoreBundle/Doctrine/DQL/DateFormat.php
  • src/Sylius/Bundle/ProductBundle/spec/EventListener/SelectProductAttributeChoiceRemoveListenerSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Doctrine/ORM/Handler/ResourceDeleteHandlerSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Customer/ShopUserBasedExtensionSpec.php
  • src/Sylius/Bundle/CoreBundle/spec/Order/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/ApiBundle/spec/CommandHandler/Cart/RemoveItemFromCartHandlerSpec.php
  • src/Sylius/Bundle/LocaleBundle/spec/Checker/LocaleUsageCheckerSpec.php
  • src/Sylius/Bundle/OrderBundle/spec/NumberGenerator/SequentialOrderNumberGeneratorSpec.php
  • src/Sylius/Bundle/AttributeBundle/spec/Doctrine/ORM/Subscriber/LoadMetadataSubscriberSpec.php
🔇 Additional comments (9)
src/Sylius/Bundle/ApiBundle/spec/Resolver/UriTemplateParentResourceResolverSpec.php (3)

19-21: LGTM! Import changes align with Doctrine ORM 3 support.

The updated imports correctly reflect the transition to support Doctrine ORM 3.


83-107: LGTM! Test updated to use Doctrine ORM 3's entity loading approach.

The changes correctly transition from repository-based entity loading to using UnitOfWork and EntityPersister while maintaining the same test logic.


113-130: LGTM! Test updated consistently with Doctrine ORM 3 changes.

The changes maintain test logic while improving type safety with ::class syntax.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/Order/VisitorBasedExtensionSpec.php (3)

85-87: LGTM! Improved type safety with specific expression types.

The change from generic Expr\Func to specific expression types (Comparison, Andx, Orx) enhances type safety and better reflects the actual expression types being used.


100-106: LGTM! Enhanced readability with explicit SQL conditions.

The change to return string literals for SQL conditions (e.g., 'user IS NULL') instead of expression objects improves readability and makes the test's intentions clearer.


107-107: LGTM! Improved type safety in query building.

The use of $exprOrx instead of $exprFunc better represents the actual expression type being used in the andWhere condition.

src/Sylius/Bundle/ApiBundle/spec/Doctrine/ORM/QueryExtension/Shop/OrderItem/VisitorBasedExtensionSpec.php (3)

86-88: LGTM! Consistent type refinement across specs.

The addition of specific expression types (Comparison, Andx, Orx) maintains consistency with the Order spec and improves type safety throughout the codebase.

Also applies to: 164-166


103-109: LGTM! Consistent SQL condition representation.

The change to use string literals for SQL conditions is consistently applied across both collection and item queries, improving readability throughout the spec.

Also applies to: 181-187


110-110: LGTM! Type-safe query building.

The use of specific expression types in andWhere conditions is consistently applied across both collection and item queries.

Also applies to: 188-188

@loic425 loic425 marked this pull request as draft February 10, 2025 08:57
Rafikooo added a commit that referenced this pull request Mar 12, 2025
| Q               | A
|-----------------|-----
| Branch?         |2.0 
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->

Extracted from #17635 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Enhanced query handling and expression management across various
components, including cart management, product filtering, and review
processing.
- Improved method chaining and parameter handling in query builders for
better flexibility in data retrieval.
- Transitioned from specific repository implementations to more generic
interfaces, enhancing flexibility.

- **Chore**
- Updated import statements and namespace structures for better
alignment with the latest library versions, ensuring compatibility and
maintainability.
- Adjusted method signatures to improve type safety and clarity in the
codebase.

These updates contribute to a more efficient and reliable user
experience throughout the shopping and order processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. Shop ShopBundle related issues and PRs. labels Mar 31, 2025
@loic425 loic425 changed the base branch from 2.0 to 2.1 March 31, 2025 12:28
@loic425 loic425 closed this Jun 3, 2025
@loic425 loic425 deleted the orm-3 branch June 3, 2025 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin AdminBundle related issues and PRs. API APIs related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. Shop ShopBundle related issues and PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant