Reputation: 195
I'm breaking my head.... why this error???? [Semantical Error] line 0, col 17 near 'Logs l': Error: Class 'Logs' is not defined.
this is my code:
<?php
namespace Alex\DatabaseBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* LogsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class LogsRepository extends EntityRepository
{
public function getLatestlogs()
{
$em = $this->getEntityManager();
$qb = $em->createQuery('SELECT l.id FROM Logs l');
return $qb->getResult();
}
}
i dont understand..... i'm new, but i'm blocked to this simple situation....
Upvotes: 1
Views: 8984
Reputation: 195
RESOLVED!!
Thank you Touki
FROM AlexDatabaseBundle:Logs
has worked for me!
Upvotes: 2
Reputation: 4397
Try below code in your repository instead, or you need to use a full namespace path SELECT l.id FROM \Acme\YourBundle\Entity\Logs l
class LogsRepository extends EntityRepository
{
public function getLatestlogs()
{
$result = $this->createQueryBuilder('l')
->select('l.id')
->getQuery()
->getResult();
}
}
Upvotes: 0