-
-
Notifications
You must be signed in to change notification settings - Fork 56
feat: add support for uuid_extract_timestamp and uuid_extract_version
#466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove XDEBUG_MODE from composer scripts to avoid redundancy - Update workflows to explicitly set XDEBUG_MODE=coverage when coverage is needed - Use --no-coverage flag when xdebug is not installed to prevent warnings - This fixes 'No code coverage driver available' warning causing CI failures
- Scrutinizer needs XDEBUG_MODE=coverage to generate coverage reports - This aligns with the GitHub Actions workflow approach
|
Warning Rate limit exceeded@martin-georgiev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 33 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughAdds two new Doctrine AST functions (UUID_EXTRACT_TIMESTAMP, UUID_EXTRACT_VERSION), documents TO_NUMBER Roman-numeral support (RN pattern, PostgreSQL 18+), updates a ToNumber PHPDoc link, and introduces corresponding unit and integration tests for the new functions and TO_NUMBER behavior. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer (DQL)
participant ORM as Doctrine ORM
participant AST as AST Function (ToNumber / UuidExtract*)
participant SQL as SQL Generator
participant DB as PostgreSQL
Dev->>ORM: Execute DQL with TO_NUMBER(...,'RN') or UUID_EXTRACT_TIMESTAMP/UUID_EXTRACT_VERSION
ORM->>AST: Resolve function node and mapping
AST->>SQL: Emit SQL prototype (to_number(...,'RN') / uuid_extract_timestamp(%s) / uuid_extract_version(%s))
SQL->>DB: Execute generated SQL
DB-->>SQL: Return result (converted number | timestamp | version | null)
SQL-->>ORM: Map SQL result back to DQL
ORM-->>Dev: Return query result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this 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)
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php (1)
37-59: Valid UUID v4 and v7 test implementations.Both tests correctly validate version extraction from properly formatted UUID v4 and v7 strings. The test coverage includes the most commonly used UUID versions.
The three test methods follow an identical pattern. Consider using PHPUnit's
DataProviderto reduce duplication:#[Test] #[DataProvider('uuidVersionProvider')] public function can_extract_version_from_uuid(string $uuid, int $expectedVersion): void { $dql = "SELECT UUID_EXTRACT_VERSION('$uuid') as result FROM Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsNumerics t WHERE t.id = 1"; $result = $this->executeDqlQuery($dql); $this->assertEquals($expectedVersion, $result[0]['result']); } public static function uuidVersionProvider(): array { return [ 'UUID v1' => ['a0eebc99-9c0b-11d1-b465-00c04fd430c8', 1], 'UUID v4' => ['550e8400-e29b-41d4-a716-446655440000', 4], 'UUID v7' => ['018e7e39-9f42-7000-8000-000000000000', 7], ]; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractTimestampTest.php(1 hunks)tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractTimestampTest.php
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-05-23T11:11:57.951Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#383
File: tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RadiansTest.php:1-9
Timestamp: 2025-05-23T11:11:57.951Z
Learning: Tests in the `Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\Unit\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase directly, and therefore don't need an explicit import.
Applied to files:
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php
📚 Learning: 2025-03-29T03:31:17.114Z
Learnt from: martin-georgiev
PR: martin-georgiev/postgresql-for-doctrine#318
File: tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/XmlAggTest.php:1-9
Timestamp: 2025-03-29T03:31:17.114Z
Learning: Tests in the `Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions` namespace extend a custom `TestCase` class from the same namespace (`Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TestCase`), rather than PHPUnit's TestCase, and therefore don't need an explicit import.
Applied to files:
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php
🧬 Code graph analysis (1)
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php (4)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersion.php (1)
UuidExtractVersion(15-22)tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php (2)
UuidExtractVersionTest(10-32)getStringFunctions(12-17)tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/NumericTestCase.php (1)
NumericTestCase(9-49)tests/Integration/MartinGeorgiev/TestCase.php (2)
requirePostgresVersion(317-344)executeDqlQuery(284-298)
🔇 Additional comments (5)
tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UuidExtractVersionTest.php (5)
1-9: LGTM! Clean imports and namespace structure.The namespace and imports are appropriate for an integration test. The use of PHPUnit's
Testattribute is correct for PHPUnit 10.
10-10: Appropriate base class selection.Extending
NumericTestCaseis correct sinceuuid_extract_versionreturns an integer value, and the base class provides the necessary fixture setup.
12-16: Correct PostgreSQL version requirement.The version check for PostgreSQL 17.0.0 is accurate, as
uuid_extract_versionwas introduced in PostgreSQL 17.
18-23: Function registration follows established pattern.The registration of
UUID_EXTRACT_VERSIONmatches the pattern used throughout the codebase for custom DQL functions.
25-35: Valid UUID v1 test implementation.The test correctly validates extraction of version 1 from a properly formatted UUID v1 string.
Summary by CodeRabbit
New Features
Documentation
Tests