Top level EXISTS query using Doctrine ORM

I have a query such as this in plain SQL (of course the original is more complex, but still simple enough that I’m quite sure that that part is correct at least): SELECT EXISTS (SELECT 1 FROM mytable …

How can I get access to related entities with Symfony doctrine?

I try to find all documents that are related to my product: public function findDocumentsRelatedToProduct($id) { return $this->createQueryBuilder(‘products’) ->…

Doctrine get Product with most sales

I have a Product Entity with many Orders as association. I want to build a repository method that brings the most sold products. Each order only have 1 product with 1 quantity so, quantity is …

Symfony : How to fetch all object data from entity related with oneToMany relationship

I have “Car” and “Booking” entities related with oneToMany relationship :

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…

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 …

Aliasing fields using partial object syntax + array hydrator in doctrine 2

Is there any way to alias fields when using partial object syntax in Doctrine 2? I know I can do this: $this->createQueryBuilder(‘user’)->select([ ‘user.id AS id’, ‘user.firstName AS …

Symfony2 persist form collections with Doctrine UNIQUE INDEX and ORDER BY?

I have a User entity that has a collection of List Items associated with it. Each List Item entity also references another entity, Topic. I have setup a UNIQUE constraint on the List Item table that …

Doctrine2 find by value in field array

i wonder if there is a way to search for a document field looking like : /** * @var array * * @ORMColumn(name=”tags”, type=”array”, nullable=true) */ private $tags; which in database looks …