Comments (3)
Fixed now in auditor master
branch.
Thanks @knallcharge for the contrib
from auditor-bundle.
Here's a stacktrace of the error:
TypeError:
Unsupported operand types: string - int
at C:\(...)\vendor\doctrine\dbal\src\Driver\SQLSrv\Statement.php:210
at Doctrine\DBAL\Driver\SQLSrv\Statement->prepare()
(C:\(...)\vendor\doctrine\dbal\src\Driver\SQLSrv\Statement.php:162)
at Doctrine\DBAL\Driver\SQLSrv\Statement->execute()
(C:\(...)\vendor\doctrine\dbal\src\Driver\Middleware\AbstractStatementMiddleware.php:69)
at Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute()
(C:\(...)\vendor\doctrine\dbal\src\Logging\Statement.php:98)
at Doctrine\DBAL\Logging\Statement->execute()
(C:\(...)\vendor\doctrine\dbal\src\Driver\Middleware\AbstractStatementMiddleware.php:69)
at Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute()
(C:\(...)\vendor\symfony\doctrine-bridge\Middleware\Debug\Statement.php:68)
at Symfony\Bridge\Doctrine\Middleware\Debug\Statement->execute()
(C:\(...)\vendor\doctrine\dbal\src\Statement.php:190)
at Doctrine\DBAL\Statement->execute()
(C:\(...)\vendor\doctrine\dbal\src\Statement.php:249)
at Doctrine\DBAL\Statement->executeStatement()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Persistence\Helper\DoctrineHelper.php:84)
at DH\Auditor\Provider\Doctrine\Persistence\Helper\DoctrineHelper::executeStatement()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\DoctrineProvider.php:136)
at DH\Auditor\Provider\Doctrine\DoctrineProvider->persist()
(C:\(...)\vendor\damienharper\auditor\src\EventSubscriber\AuditEventSubscriber.php:38)
at DH\Auditor\EventSubscriber\AuditEventSubscriber->onAuditEvent()
(C:\(...)\vendor\symfony\event-dispatcher\EventDispatcher.php:220)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
(C:\(...)\vendor\symfony\event-dispatcher\EventDispatcher.php:56)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionProcessor.php:49)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor->notify()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionProcessor.php:233)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor->audit()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionProcessor.php:84)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor->update()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionProcessor.php:150)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor->processUpdates()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionProcessor.php:40)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor->process()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Transaction\TransactionManager.php:32)
at DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionManager->process()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Event\DoctrineSubscriber.php:45)
at DH\Auditor\Provider\Doctrine\Auditing\Event\DoctrineSubscriber->DH\Auditor\Provider\Doctrine\Auditing\Event\{closure}()
(C:\(...)\vendor\damienharper\auditor\src\Provider\Doctrine\Auditing\Logger\Middleware\DHConnection.php:27)
at DH\Auditor\Provider\Doctrine\Auditing\Logger\Middleware\DHConnection->commit()
(C:\(...)\vendor\doctrine\dbal\src\Connection.php:1464)
at Doctrine\DBAL\Connection->doCommit()
(C:\(...)\vendor\doctrine\dbal\src\Connection.php:1422)
at Doctrine\DBAL\Connection->commit()
(C:\(...)\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:472)
at Doctrine\ORM\UnitOfWork->commit()
(C:\(...)\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:403)
at Doctrine\ORM\EntityManager->flush()
(C:\(...)\src\Repository\EntityRepository.php:121)
at App\Repository\EntityRepository->save()
(C:\(...)\src\Controller\IndexController.php:234)
at App\Controller\IndexController->index()
(C:\(...)\vendor\symfony\http-kernel\HttpKernel.php:182)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(C:\(...)\vendor\symfony\http-kernel\HttpKernel.php:76)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(C:\(...)\vendor\symfony\http-kernel\Kernel.php:197)
at Symfony\Component\HttpKernel\Kernel->handle()
(C:\(...)\vendor\symfony\runtime\Runner\Symfony\HttpKernelRunner.php:35)
at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
(C:\(...)\vendor\autoload_runtime.php:29)
at require_once('C:\\(...)\\vendor\\autoload_runtime.php')
(C:\(...)\public\index.php:5)
from auditor-bundle.
I did some more research on this an found the cause and the solution to the problem:
The issue is that MSSQL can't handle named parameters the way MySQL does in Doctrine. So preparing the statement in src/Provider/Doctrine/DoctrineProvider.php of auditor will mess up the query for MSSQL, resulting in the mentioned problems.
This is the query from the statement:
INSERT INTO entityname_audit (type, object_id, discriminator, transaction_hash, diffs, blame_id, blame_user, blame_user_fqdn, blame_user_firewall, ip, created_at) VALUES (:type, :object_id, :discriminator, :transaction_hash, :diffs, :blame_id, :blame_user, :blame_user_fqdn, :blame_user_firewall, :ip, :created_at)
And this is the one that'll work for MSSQL (while still working for MySQL!):
INSERT INTO entityname_audit (type, object_id, discriminator, transaction_hash, diffs, blame_id, blame_user, blame_user_fqdn, blame_user_firewall, ip, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Of course the binding of the parameters has to be changed to integer-keys to make this work, but this can be done with some minor changes.
I have created a pull request in auditor that you may want to check out (DamienHarper/auditor#182).
from auditor-bundle.
Related Issues (20)
- datetimeformat in config
- Call to a member function addEventSubscriber() on null in DoctrineProvider HOT 10
- Example Annotation `use` Statement Shown for Auditing Configuration in Docs Undefined HOT 2
- Customizing the views HOT 2
- Make a new release HOT 12
- Doctrine subscriber is deprecated HOT 1
- Symfony 6.4 HOT 4
- Deprecation in Symfony 6.4 HOT 3
- Symfony 7 compatibility HOT 7
- Performance issues in Symfony 6.4
- /audit route does not after upgrade HOT 4
- Additional CSS classes in twig HOT 2
- No mapping information to process when using DoctrineMigrationsBundle
- New release HOT 5
- Restore an entity
- Duplicated audit entries
- Update SimpleFilter value type to accept int HOT 1
- Symfony 7 installation error HOT 3
- [UserProvider] audit entry without identifier
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auditor-bundle.