I have 3 records of datatype in database and two of them have different year. My sql query is: 'SELECT DISTINCT YEAR(postdate) from post'.
in PostRepository.php I have such function:
<?php
namespace Dev\TaskBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\DoctrineExtensions\Query\Mysql;
class PostRepository extends EntityRepository{
public function getYears(){
return $this->createQueryBuilder('p')
->select('YEAR(p.postdate')->distinct()
->getQuery()
->getResult();
}
}
I had configured config.yml before and the error I receive is:
Attempted to load class "Year" from namespace "DoctrineExtensions\Query\Mysql". Did you forget a "use" statement for another namespace?
Could someone explain what's wrong?