-
Notifications
You must be signed in to change notification settings - Fork 52
added _deletedAt to $deletedAt translation #602
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
base: 0.69.x
Are you sure you want to change the base?
Conversation
WalkthroughA new mapping was added in the SQL adapter's internal method to associate the attribute key Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
Documentation and Community
|
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: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/Database/Adapter/SQL.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Setup & Build Docker Image
| '$tenant' => '_tenant', | ||
| '$createdAt' => '_createdAt', | ||
| '$updatedAt' => '_updatedAt', | ||
| '$deletedAt' => '_deletedAt', |
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.
💡 Verification agent
🧩 Analysis chain
LGTM! Verify the complete implementation of $deletedAt support.
The mapping addition follows the established pattern correctly and aligns with the existing timestamp attribute mappings ($createdAt and $updatedAt). This change enables the SQL adapter to recognize and translate the $deletedAt attribute for soft delete functionality.
Please verify that the implementation is complete by checking if similar handling for $deletedAt is needed in:
🏁 Script executed:
#!/bin/bash
# Description: Check if $deletedAt handling is needed in other methods like $createdAt and $updatedAt
echo "=== Checking getDocument method for timestamp handling patterns ==="
ast-grep --pattern $'if (\array_key_exists($_, $document)) {
$document[$_] = $document[$_];
unset($document[$_]);
}'
echo "=== Checking getAttributeProjection method for timestamp selection handling ==="
ast-grep --pattern $'if (\in_array($_, $selections)) {
$selections[] = $this->getInternalKeyForAttribute($_);
$selections = \array_diff($selections, [$_]);
}'
echo "=== Searching for any existing references to deletedAt ==="
rg -i "deletedat|deleted_at" --type phpLength of output: 845
Add symmetric handling for $deletedAt in SQL adapter
You’ve correctly added the '$deletedAt' => '_deletedAt' mapping, but to fully support soft deletes you’ll need to mirror the same conversion logic used for $createdAt and $updatedAt:
• In getDocument (around lines 381–388) convert _deletedAt back to deletedAt.
• In getAttributeProjection (around lines 1702–1708) include _deletedAt when deletedAt is selected.
• If your updateDocuments method applies special logic for _updatedAt, consider whether deletedAt updates need similar handling.
Please add these adjustments to ensure the adapter correctly translates and projects the deletedAt attribute.
🤖 Prompt for AI Agents
In src/Database/Adapter/SQL.php around lines 381 to 388, 1702 to 1708, and near
the updateDocuments method, you need to add symmetric handling for the
$deletedAt attribute to fully support soft deletes. Specifically, in
getDocument, convert the internal key _deletedAt back to deletedAt like you do
for _createdAt and _updatedAt. In getAttributeProjection, when deletedAt is
selected, include _deletedAt in the selections array similarly to the other
timestamps. Also, review updateDocuments for any special logic applied to
_updatedAt and add equivalent handling for deletedAt updates if needed. This
ensures consistent translation and projection of the deletedAt attribute
throughout the adapter.
Summary by CodeRabbit