[PR #1434] convertToDatabaseValueSQL with $columnName #9492

Closed
opened 2026-01-22 16:04:29 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/1434

State: closed
Merged: No


Goal:

I want to be able to atomically increment a property such that $stock->setQuantityDelta(2); will render into an SQL such as UPDATE stock SET quantity = quantity+? WHERE id = ?;.

I would like to accomplish this without using DQL every time it is necessary hence I implemented a custom Doctrine2 type which can accomplish this -- with support from this PR.

Changes:

\Doctrine\ORM\Persisters\BasicEntityPersister::updateTable now passes the column name to \Doctrine\DBAL\Types\Type::convertToDatabaseValueSQL (PR) to be used by the concrete type instance (ex.: @mihai-stancu/doctrine-types-extra:\MS\Doctrine\DBAL\Types\DeltaType).

**Original Pull Request:** https://github.com/doctrine/orm/pull/1434 **State:** closed **Merged:** No --- ## Goal: I want to be able to atomically increment a property such that `$stock->setQuantityDelta(2);` will render into an SQL such as `UPDATE stock SET quantity = quantity+? WHERE id = ?;`. I would like to accomplish this without using `DQL` every time it is necessary hence I implemented a custom Doctrine2 type which can accomplish this -- with support from this PR. ## Changes: `\Doctrine\ORM\Persisters\BasicEntityPersister::updateTable` now passes the column name to `\Doctrine\DBAL\Types\Type::convertToDatabaseValueSQL` ([PR](https://github.com/doctrine/dbal/pull/874)) to be used by the concrete type instance (ex.: **@mihai-stancu/doctrine-types-extra**:`\MS\Doctrine\DBAL\Types\DeltaType`).
admin added the pull-request label 2026-01-22 16:04:29 +01:00
admin closed this issue 2026-01-22 16:04:29 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9492