Category: query-builder

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…

MEMBER OF with array_values AND operator

there is my problem : return $this->createQueryBuilder(‘p’) ->select(‘p as post’) ->where(‘:tags MEMBER OF p.tags’) ->setParameter(‘tags’, array_values($tagArray)) ->orderBy(‘p.postedAt’, ‘DESC’) ->setFirstResult($start) ->setMaxResults($limit) ->getQuery() ->getResult() ; With this code, I can retrieve all posts that have as tags those present in $tagArray. But…