Problem get history for OneToMany relation
gundamkid opened this issue · 3 comments
gundamkid commented
Q | A |
---|---|
Bug report? | yes |
BC Break report? | yes |
Yesterday i got an issue when i tries to implement OneToMany audit:
- I have 2 table User and Address with relationship is OneToMany.
- The audit can log when I change Address.
- But when i want to show history I get this error (i will post full error for you to easy tracking)
{
"message": "An exception occurred while executing 'SELECT e.revtype, e.id AS `id`, e.street AS `street`, e.city AS `city`, e.district AS `district`, e.postal_code AS `postalCode`, e.country AS `country`, e.type AS `type`, e.created_at AS `createdAt`, e.modified_at AS `modifiedAt`, e.icare_member_id FROM address_audit e WHERE (e.rev <= ?) AND (e.id = ?) ORDER BY e.rev DESC' with params [\"1955\"]:\n\nSQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens",
"class": "Doctrine\\DBAL\\Exception\\DriverException",
}
This is problem from audit
{
"namespace": "Doctrine\\DBAL\\Query",
"short_class": "QueryBuilder",
"class": "Doctrine\\DBAL\\Query\\QueryBuilder",
"type": "->",
"function": "execute",
"file": "/var/www/b2b/employee-management/src/SimpleThings/EntityAudit/AuditReader.php",
"line": 325,
"args": []
},
{
"namespace": "SimpleThings\\EntityAudit",
"short_class": "AuditReader",
"class": "SimpleThings\\EntityAudit\\AuditReader",
"type": "->",
"function": "find",
"file": "/var/www/b2b/employee-management/vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/Collection/AuditedCollection.php",
"line": 427,
"args": [
[
"string",
"ICare\\EmployeeBundle\\Entity\\Address"
],
[
"array",
[]
],
[
"string",
"1955"
]
]
},
{
"namespace": "SimpleThings\\EntityAudit\\Collection",
"short_class": "AuditedCollection",
"class": "SimpleThings\\EntityAudit\\Collection\\AuditedCollection",
"type": "->",
"function": "resolve",
"file": "/var/www/b2b/employee-management/vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/Collection/AuditedCollection.php",
"line": 437,
"args": [
[
"array",
{
"rev": [
"string",
"1953"
],
"keys": [
"array",
[]
]
}
]
]
},
{
"namespace": "SimpleThings\\EntityAudit\\Collection",
"short_class": "AuditedCollection",
"class": "SimpleThings\\EntityAudit\\Collection\\AuditedCollection",
"type": "->",
"function": "forceLoad",
"file": "/var/www/b2b/employee-management/vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/Collection/AuditedCollection.php",
"line": 360,
"args": []
},
{
"namespace": "SimpleThings\\EntityAudit\\Collection",
"short_class": "AuditedCollection",
"class": "SimpleThings\\EntityAudit\\Collection\\AuditedCollection",
"type": "->",
"function": "getIterator",
"file": "/var/www/b2b/employee-management/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php",
"line": 103,
"args": []
},
{
"namespace": "JMS\\Serializer",
"short_class": "GenericSerializationVisitor",
"class": "JMS\\Serializer\\GenericSerializationVisitor",
"type": "->",
"function": "visitArray",
"file": "/var/www/b2b/employee-management/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php",
"line": 55,
"args": [
[
"object",
"SimpleThings\\EntityAudit\\Collection\\AuditedCollection"
],
[
"array",
{
"name": [
"string",
"array"
],
"params": [
"array",
[
[
"array",
{
"name": [
"string",
"ICare\\EmployeeBundle\\Entity\\Address"
],
"params": [
"array",
[]
]
}
]
]
]
}
],
[
"object",
"JMS\\Serializer\\SerializationContext"
]
]
},
Sorry for very long comment :(.
gundamkid commented
the reason is my JSon Serializer, not from EntityAuditBundle.
Thank you!
DavidBadura commented
So, we can close this? Thanks!
gundamkid commented
@DavidBadura yep, please help me close this. Thanks!
p/s: I can close myself!