Count Rows in Doctrine QueryBuilder

Something like: $qb = $entityManager->createQueryBuilder(); $qb->select(‘count(account.id)’); $qb->from(‘ZaysoCoreBundle:Account’,’account’); $count = $qb->getQuery()->getSingleScalarResult(); Some folks feel that expressions are somehow better than just using straight DQL. One even went so far as to edit a four year old answer. I rolled his edit back. Go figure.

How to render a DateTime object in a Twig template

Although you can use the {{ game.gameDate|date(‘Y-m-d’) }} approach, keep in mind that this version does not honor the user locale, which should not be a problem with a site used by only users of one nationality. International users should display the game date totally different, like extending the \DateTime class, and adding a __toString() … Read more

What is the difference between .yaml and .yml extension? [duplicate]

File extensions do not have any bearing or impact on the content of the file. You can hold YAML content in files with any extension: .yml, .yaml or indeed anything else. The (rather sparse) YAML FAQ recommends that you use .yaml in preference to .yml, but for historic reasons many Windows programmers are still scared … Read more

Running Composer returns: “Could not open input file: composer.phar”

If you followed instructions like these: https://getcomposer.org/doc/00-intro.md Which tell you to do the following: $ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer Then it’s likely that you, like me, ran those commands and didn’t read the next part of the page telling you to stop referring to composer.phar by its full name and … Read more

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

To get the current memory_limit value, run: php -r “echo ini_get(‘memory_limit’).PHP_EOL;” Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems): ; Use -1 for unlimited or define an explicit value like 2G memory_limit = -1 Or, you can increase the limit with a command-line argument: php -d memory_limit=-1 composer.phar require hwi/oauth-bundle … Read more

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