mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3785: DBAL types are ignored in the ManyToManyPersister #4637
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jun 23, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user dadamssg:
If you're using custom DBAL types for id's, they are ignored and the value object is passed directly to be bound to the query.
For example, I have an Asset that has many Attributes. My asset's id is an AssetId object. I've created a custom DBAL type for AssetId. Whenever doctrine attempts to cleanse the Asset from orphaned Attributes an exception is thrown:
bq. An exception occurred while executing 'DELETE FROM asset_attributes WHERE asset_id = ?' with params [{}]: Warning: oci_bind_by_name(): Invalid variable used for bind
The ManyToManyPersister::delete() method does not pass along any $types to the Connection::executeUpdate() method. The executeUpdate() method checks if there are types and if there are none, does not pass the params to the _bindTypedValues() method, which I think is the problem. The params(AssetId) get passed directly to the $stmt->execute($params) method call.
I believe the ManyToManyPersister::delete() method needs to look like this. This seems to work.