I have this function in my repository:
public function findLatestFeeAsigned($company_id) {
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('c', 'chw');
$qb->from('Configuration\FeeBundle\Entity\Fee', 'c');
$qb->leftJoin('Company\ApprovalBundle\Entity\CompanyHasWtax', 'chw', \Doctrine\ORM\Query\Expr\Join::WITH, 'c.id = chw.wtax');
$qb->where('chw.company = ?1');
$qb->orderBy('chw.created', 'ASC');
$qb->setMaxResults(1);
$qb->setParameter(1, $company_id);
return $qb->getQuery()->getResult();
}
And I call it from my controller in this way:
$entityCurrentFee = $em->getRepository('ApprovalBundle:CompanyHasWtax')->findLatestFeeAsigned($id);
Where $id
is a request parameter. Then I try to get the some column values as:
$entityCurrentFee->getId();
But I got error saying that $entityCurrentFee
is not a object, why is that?