Category: query-builder

Symfony Doctrine query builder find entity with many to one relation

I’m building a website with Symfony for a project which will act like “booking.com” websites but much simplier and with some variations. Some errors on the database fields but not really important for my issue. As you can see, these…

Getting error on NOT IN subquery in Doctrine (Symfony 4)

I’m trying to convert this MySql query SELECT appcs_training.name, appcs_training.id FROM appcs_training WHERE appcs_training.id NOT IN (SELECT training_id FROM appcs_user_purchased_trainings WHERE user_id = 54) into a queryBuilder but I am getting the following error over and over again… I would…

Symfony 4 Doctrine 2 findby dosent apply Join and custom join doesn’t work

i’m relatively new with Symfony 4 and Doctrine ORM. I’m trying to get all comments posted from one user when browsing this user profile page. Here’s my comment entity <?php namespace AppEntity; use DoctrineORMMapping as ORM; /** * @ORMEntity(repositoryClass=”AppRepositoryCommentsRepository”) */…

Symfony Doctrine: Search in simple_array

I got values stored in my database column field as value1,value2,value3,value4, so a simple_array column. So i’m using Doctrine to make a search using this: $searchQuery = $this->getDoctrine() ->getRepository(‘AppBundle:Ads’) ->createQueryBuilder(‘p’) ->andWhere(“p.vals <= :value2”) ->setParameter(‘value2’, $request->query->get(‘value2’)); ->orderBy(“p.creationtime”, ‘DESC’); So expecting value2…