I guess that this is really trivial and stupid question, but I don't know how to install Doctrine Extensions - https://github.com/beberlei/DoctrineExtensions in my Symfony2 project. I need them because of the MONTH, YEAR functions. Where should I put their folder? And should I put the whole DoctrineExtensions
folder? And where to write this:
<?php
$classLoader = new DoctrineCommonClassLoader('DoctrineExtensions', "/path/to/extensions");
$classLoader->register();
In a separate file? Where to put it and how to call it?
And then is this all I need to use them:
public function findOneByYearMonthDay($year, $month, $day)
{
$emConfig = $this->getEntityManager()->getConfiguration();
$emConfig->addCustomDatetimeFunction('YEAR', 'DoctrineExtensionsQueryMysqlYear');
$emConfig->addCustomDatetimeFunction('MONTH', 'DoctrineExtensionsQueryMysqlMonth');
$emConfig->addCustomDatetimeFunction('DAY', 'DoctrineExtensionsQueryMysqlDay');
Thank you very much in advance and sorry once again for the question, but I couldn't find a tutorial (which makes me feel even more guilty, because I guess it's too trivial when there isn't even a tutorial)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…