Skip to content
Advertisement

Tag: doctrine

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

New alternative for getDoctrine() in Symfony 5.4 and up

As my IDE points out, the AbstractController::getDoctrine() method is now deprecated. I haven’t found any reference for this deprecation neither in the official documentation nor in the Github changelog. What is the new alternative or workaround for this shortcut? Answer As mentioned here: Instead of using those shortcuts, inject the related services in the constructor or the controller methods. You

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

Symfony 3.4 – cannot load field value

I’m using Symfony 3.4.47 w/ MySQL 8 and getting a field value wasn’t a big thing until today. I’ve created a migration file to add a new field to an existing entity: And I’ve added the field ‘cliente_apelido’, getter and setter to the ‘Plano.php’ model: It turns that, when I’m trying to use the getClienteapelido() getter, it returns an empty

Symfony 5 – ManyToOne __isInitialized__: false

I try to get value from object but objects return __isInitialized__: false and null values what did I miss? twig situ dump : situ entity : event entity : category entity : Answer You just got to know the doctrine lazy loading feature. It fetches the data until you fired the getter method the first time. You could know this

“Error [Semantical Error] The annotation “@DoctrineORMMappingOnetoMany” in property” on Gitlab CI but not in local env or production [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed last year. Improve this question I’ve

Advertisement