Doctrine Secrets ... for me ))) from StackOverflow and other Internet resources



Doctrine Secrets


Avoid using Doctrine’s Collection::matching method - very useful when you work with the Doctrine collections

Temporarily change fetch mode in DQL - sometimes its useful

Symfony2 and Doctrine - Error: Invalid PathExpression. Must be a StateFieldPathExpression

You can use the currently undocumented IDENTITY function to select the FK IDs in a query: SELECT IDENTITY(c.parent) ... or you must do $qb->innerJoin("c.parent", "p")


Left join ON condition AND other condition syntax in Doctrine


use Doctrine\ORM\Query\Expr;
->leftJoin('a.installations''i', Expr\Join::WITH, 'i.page = :page')
->setParameter('page', $page)




Count Rows in Doctrine QueryBuilder
$qb = $entityManager->createQueryBuilder();
$qb->select('count(account.id)');
$qb->from('ZaysoCoreBundle:Account','account');

$count = $qb->getQuery()->getSingleScalarResult();

Comments

Popular posts from this blog

Интересное о Формальдегиде

Открываем порт для сервера Minecraft на роутере mikrotik (команда для терминала в WinBox)