‘where not in’ query with doctrine query builder

You need to use query builder expressions, and this means you need access to the query builder object. Also, the code is easier to write if you generate the subselect list ahead of time: $qb = $em->createQueryBuilder(); $nots = $qb->select(‘arl’) ->from(‘$MineMyBundle:MineAssetRequestLine’, ‘arl’) ->where($qb->expr()->eq(‘arl.asset_id’,1)) ->getQuery() ->getResult(); $linked = $qb->select(‘rl’) ->from(‘MineMyBundle:MineRequestLine’, ‘rl’) ->where($qb->expr()->notIn(‘rl.request_id’, $nots)) ->getQuery() ->getResult();

Doctrine OneToOne incorrectly? generating a UNIQUE INDEX

If One organisation has Many Users and Many Users have One and only one organisation then it’s not a One-to-One association. One-to-One associations have to be unique. Your association is ManyToOne on the User side and OneToMany on the organisation side. User.php /** * @ManyToOne(targetEntity=”Organisation”) */ private $organisation; Organisation.php use Doctrine\Common\Collections\ArrayCollection; /** * @OneToMany(targetEntity=”User”, mappedBy=”organisation”) … Read more

How to OrderBy on OneToMany/ManyToOne

In the Product entity you just need to add the orderBy to the ingredients relation /** * @ORM\OrderBy({“some_attribute” => “ASC”, “another_attribute” => “DESC”}) */ private $ingredients; With PHP 8 attributes: #[ORM\OrderBy([‘some_attribute’ => ‘ASC’, ‘another_attribute’ => ‘DESC’])] private $ingredients;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)