I am currently trying to set up from scratch a Symfony 5 project using Doctrine with XML mapping. I created a simple AppBundle with some entities. After trying to generate my migration, I have this error : No mapping file found named ‘User.orm.xml’ for class ‘AppEntityUserUser’. A quick google search tells me it might be a conflict with annotations (which
Tag: doctrine-orm
Deserialize a entities array with Symfony Serializer Component and AbstractNormalizer::OBJECT_TO_POPULATE
I already deserialize into a array of object with : $encoders = [new JsonEncoder()]; $normalizers = [new ObjectNormalizer(), new GetSetMethodNormalizer(), new ArrayDenormalizer()]; $serializer = new …
How i persist data with @ManyToMany Symfony4
I have problem when I want import data (csv) officer with relation ManyToMany Department : the officer (agent in french) are store but the relation are not created (table agent_departement). Agent …
WebfactoryPolyglotBundle use causes error “No mapping found for field ‘id’ on class ‘AppBundleEntityFilm’.”
I use the Symfony version 3.4.0 and I try to use this bundle to translate entities : https://github.com/webfactory/WebfactoryPolyglotBundle So I created two entities ( Film and FilmTranslation ) for …
Attempted to call an undefined method named “getEntityManager” of class
I’m learning symfony and I would like to have a search bar to show user with email. But I got and error Attempted to call an undefined method named “getEntityManager” of class “AppRepository…
How to autoload custom annotation classes without using AnnotationRegistry?
I’m using Doctrine Annotations library (not the whole Doctrine, only annotations) and want to make a custom annotation class. composer.json: index.php: entities/MyClass.php annotations/TestAnnotation.php It gives me the following error: The only solution i found on the Internet is to use AnnotationRegistry::registerLoader or something similar, but it is deprecated so i’d like to solve the problem in another way. Answer One
File not found exception on Symfony upload
I’m using Symfony 3.4 to work on a simple REST API microservice. There are not much resources to be found when working with HTTP APIs and file uploads. I’m following some of the instructions from the …
Return data from Doctrine inside a JsonResponse object
My problem is that I want to return some data that I get from Doctrine inside a JsonResponse object. I get the data with a QueryBuilder, like this: However, the data inside the JsonResponse looks empty: Does anyone know how I can return the data this way correctly? Answer I think you’re getting the array of Users correctly from the
Doctrine – Hydrate collection in Entity class
I have a problem regarding a bi-directional OneToMany <-> ManyToOne relationship between my entities Device and Event. This is how mapping looks: The problem comes because Device is a Single Table Inheritance entity and each time I fetch and iterate over some Event entities, then $device is always eagerly fetched. This happens because it’s a STI entity as reported in
Doctrine select with null
Is there a possibility to execute something like: $builder = $this->getEntityManager()->createQueryBuilder(); $builder->select( ‘f.id’, … ‘NULL AS missing_attribute’…