doctrine
‘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();
Generate unique id – doctrine – symfony2
As of version 2.3, you can just add the following annotations to your property: /** * @ORM\Column(type=”guid”) * @ORM\Id * @ORM\GeneratedValue(strategy=”UUID”) */ protected $id;
Symfony 2 + Doctrine 2 + PHPUnit 3.5: Serialization of closure exception
Not technically related to your issue. However, I had a really hard time trying to solve the “Serialization of ‘Closure’ is not allowed” issue while using PHPUnit, and this question is the top Google result. The problem comes from the fact that PHPUnit serializes all the $GLOBALS in the system to essential back them up … Read more
How to get a Collection in Doctrine2’s query results
The getResult() always returns an array. If you want a collection, you must pass the array that is returned by getResult() to Doctrine’s ArrayCollection e.g. use Doctrine\Common\Collections\ArrayCollection; $result = $this ->getEntityManager() ->createQueryBuilder() ->select(‘p’) ->from(‘…\Player’, ‘p’) ->getQuery() ->getResult() ; $players = new ArrayCollection($result);
tar: Error is not recoverable: exiting now
I would try to unzip and untar separately and see what happens: mv Doctrine-1.2.0.tgz Doctrine-1.2.0.tar.gz gunzip Doctrine-1.2.0.tar.gz tar xf Doctrine-1.2.0.tar