Details
Description
First off, here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to an interface: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine).
I'm going by these docs:
http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html
However, when adding a user to a group, I'm getting a weird error:
An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params
{"1":2,"2":1,"3":2,"4":1}:
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
For some reason it's adding 4 parameters to the statement instead of 2.
Oddly enough, the query generation works perfectly fine when I replace the interface in the mapping with the actual final entity. But that wasn't the point of the exercise...
I need to use the interface there.
Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine.
The schema validates as well, using doctrine:schema:validate in the console.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to a mapped superclass: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine).
I'm going by these docs: https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the mapped superclass in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the mapped superclass there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. Here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087 |
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to a mapped superclass: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine).
I'm going by these docs: https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, when adding a user to a group, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the mapped superclass in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the mapped superclass there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. Here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087 |
| Description |
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to a mapped superclass: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine).
I'm going by these docs: https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, when adding a user to a group, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the mapped superclass in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the mapped superclass there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. Here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087 |
First off, here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to a mapped superclass: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine). I'm going by these docs: https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, when adding a user to a group, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the mapped superclass in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the mapped superclass there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. |
| Priority | Blocker [ 1 ] | Minor [ 4 ] |
| Summary | Many-to-many not working with interface as mapped superclass | Many-to-many not working with interface |
| Description |
First off, here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to a mapped superclass: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine). I'm going by these docs: https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#mapped-superclasses http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, when adding a user to a group, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the mapped superclass in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the mapped superclass there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. |
First off, here's a pastie with all the code and mappings involved, and a stacktrace: http://pastie.org/5372087
Not sure if this a bug or not, but I think that according to the docs this should work - in a vendor bundle I have an entity defining a unidirectional many-to-many relation to an interface: the entity is Group and defines a many-to-many relation to a UserInterface, which is resolved correctly in the app configuration (as the many-to-one relations using it in the other entities of this vendor bundle work fine). I'm going by these docs: http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html However, when adding a user to a group, I'm getting a weird error: An exception occurred while executing 'INSERT INTO acme_group_user (group_id, user_id) VALUES (?, ?)' with params {"1":2,"2":1,"3":2,"4":1}: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens For some reason it's adding 4 parameters to the statement instead of 2. Oddly enough, the query generation works perfectly fine when I replace the interface in the mapping with the actual final entity. But that wasn't the point of the exercise... :( I need to use the interface there. Also, in other entities in that GroupBundle which are referencing the UserInterface using a different relation type, i.e. many-to-one, the relations work perfectly fine. The schema validates as well, using doctrine:schema:validate in the console. |
| Priority | Minor [ 4 ] | Major [ 3 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.2 [ 10157 ] | |
| Resolution | Fixed [ 1 ] |