Skip to content

Conversation

@AymDev
Copy link

@AymDev AymDev commented Feb 3, 2026

Related to #396 : I added attributes for (most, not all) properties matching the getters of the Location interface, so we can easily map them to Doctrine entity properties as we can already do for latitude & longitude. Let me know what you think 🙂

Summary by CodeRabbit

New Features

  • Extended geocoding data capture: Addresses now automatically store geographic bounds (north, south, east, west), street details (street number and name), and location information (locality, postal code, sub-locality, and country).

Tests

  • Added test coverage validating the expanded geocoding field assignments.

Adds additionnal attributes to be able to automatically map them
to Doctrine entities.
@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This PR extends geocoding functionality to capture additional address metadata beyond latitude and longitude. It introduces 10 new PHP 8 attributes for boundary coordinates (north, south, east, west) and address components (street number/name, locality, postal code, sub-locality, country), updates metadata infrastructure to track these fields, and integrates result mapping in the entity listener.

Changes

Cohort / File(s) Summary
Mapping Attributes
src/Mapping/Attributes/{Country, East, Locality, North, PostalCode, South, StreetName, StreetNumber, SubLocality, West}.php
Adds 10 new empty PHP 8 attribute classes (one per file) targeting properties, enabling property-level annotations for geocoding metadata.
Mapping Infrastructure
src/Mapping/ClassMetadata.php, src/Mapping/Driver/AttributeDriver.php
Extends ClassMetadata constructor with 10 new public readonly ReflectionProperty parameters for the new geocoding fields; refactors AttributeDriver to use PROPERTY_MATRIX constant mapping attribute classes to property names, replacing explicit attribute checks.
ORM Integration
src/Doctrine/ORM/GeocodeEntityListener.php
Adds assignments of 10 new geocoding result fields (bounds, street details, location info, country) to entity properties when processing geocoding results.
Test Fixtures
tests/Functional/Fixtures/Entity/DummyWithProperty.php, tests/Mapping/Driver/Fixtures/Dummy.php
Extends test entity classes with 10 new geocoding properties (north, south, east, west, streetNumber, streetName, locality, postalCode, subLocality, country) annotated with corresponding attributes and Doctrine column definitions.
Tests
tests/Functional/GeocodeEntityListenerTest.php, tests/Mapping/Driver/AttributeDriverTest.php
Adds QUERY_BERLIN and QUERY_PARIS constants to GeocodeEntityListenerTest and refactors tests to use them; adds assertions in AttributeDriverTest verifying presence of new metadata properties.

Sequence Diagram

sequenceDiagram
    participant Entity as Entity Class
    participant Attrs as Attribute Classes
    participant Driver as AttributeDriver
    participant Metadata as ClassMetadata
    participant Listener as GeocodeEntityListener
    participant Result as Geocoding Result

    Entity->>Attrs: Property annotated with<br/>North, South, East, etc.
    Driver->>Entity: Scan for attributes
    Driver->>Driver: Match via PROPERTY_MATRIX
    Driver->>Metadata: Create with property<br/>reflections
    Listener->>Result: Receive geocoding result
    Result-->>Listener: Return bounds, address<br/>components
    Listener->>Entity: Assign north, south, east,<br/>west, street*, locality,<br/>postalCode, subLocality,<br/>country
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • PR #377: Modifies the attribute-based mapping system with updates to ClassMetadata and AttributeDriver metadata handling.
  • PR #391: Updates AttributeDriver, ClassMetadata constructor, and GeocodeEntityListener for metadata-driven configuration changes.

Poem

🐰 Hop, skip, and bounds away!
Ten new attributes to light the way,
From north to south, from east to west,
Our geocoding now knows its very best! 🗺️

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Additional Doctrine attributes' directly describes the main purpose of the changeset - adding new Doctrine mapping attributes (North, South, East, West, StreetNumber, StreetName, Locality, PostalCode, SubLocality, Country) to support geocoding properties.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Failure to add the new IP will result in interrupted reviews.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant