I upgraded a legacy project from: PHP 5.6 -> 8.0 doctrine/orm 2.5.14 -> 2.13.4 doctrine/data-fixtures 1.2.2 -> 1.5.3 Now the following code throws the exception: PDOException : There is no active transaction /var/www/html/src/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:120 /var/www/html/src/vendor/doctrine/dbal/src/Connection.php:1481 /var/www/html/src/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:280 The exception is thrown when DoctrineORMEntityManager::transactional calls: $this->conn->commit() In the documentation I read: Not all RDBMS have the capability to allow TRUNCATE statements inside transactions
Tag: doctrine-orm
Doctrine 2.13.2 Warning: Object of class Enum could not be converted to int
Since last week I noticed problem on few places in the app I am working on. After investigation I found that with Everything is ok, but with: App brakes on places where I use enum in query like: I tried to read about it: here and here but I do not see info about this. Error is written in title.
Symfony 6 – How to access properties of object of specific ID
I have two entities – one is Product, second – Order. I’ve created controllers to navigate between page of ProductController that lists the whole ProductRepository to the page of OrderController, which should: take a Product ID to show its properties on the Order page (name and price) have a form with quantity and “customer’s” email to be added to the
postUpdate, postRemove, postPersist – is the data in the database yet?
For the purposes of the question I’ll ask about postUpdate but I’m assuming they’re all analogous. If I fetch an existing entity, modify it, and then flush, then I can subscribe to a postUpdate event about this. At the point that this event fires, is the data actually in the database yet? Or there a tiny amount of time in
Doctrine ORM: Ignore all events with persist and flush
I’m working on a system which uses doctrine/orm 2.6 (PHP 7.1 & MySQL 5.7) and am trying to update a large number of entities using the following code: The issue I’m running into is that the entities have lots of lifecycle events registered (preUpdate, prePersist, postUpdate, postPersist), and some of these events involve expensive operations which aren’t necessary when doing
When a decimal column is mapped to a typehinted float property, doctrine updates a field even if not changed
I have a User class, with the field Or with php8, same behavior: If I load a user, even without changing anything, at the next flush(), doctrine will send a query to update its credit: (This is very dangerous because the credit may have been changed in the meanwhile by another script, reverting the change. The credit isn’t supposed to
Error: Expected Literal, got ‘*’ in Doctrine
I want to retrieve the number of rows in my courrier table. In my fixtures, I have these lines : I have these mistakes when I do symfony console doctrine:fixtures:load : What’s wrong with the * in my query ? Answer Doctrine expects you to use one of the fields of your entity. In SQL you don’t need to use
How to automatically trim string when persisting a Doctrine entity?
Let’s say I have this entity: My controller: I want doctrine to register the name of myEntity as awesome name and not awesome name . Is there a way to configure doctrine to do this? Answer You do not need to “configure doctrine” in any way. Just use PHP and introduce the logic in your entity: This way your data
Symfony Registering New User getUser returns null on handling request
Trying to register a new user with a form and ajax request (as it will become a modal form) and hit a snag on trying to validate the form. When the request gets handled, it states that the user is null in the password validator. And not understand how to get past this or allow this one route to allow
Unable to create new answer in Symfony
I’m making a a app in Symfony. I get Entities Answer and Question which are related. I want to enable users to add the answer to the question but I’ve got the problem with getting question_id to AnswerEntity. Here it what I came up with: Answer Controller AnswerForm: and AnswerEntity The error is: [enter image description here][1] [1]: https://i.stack.imgur.com/fYGpo.png but