Symfony Semantical Error - has no field or association

940 Views Asked by At

I'm getting the error in ORM/Symfony:

[Semantical Error] line 0, col 73 near 'group = :groupId': Error: Class ActGood\CommunityBundle\Entity\GroupReporting has no field or association named group

My query is:

return $this->getEntityManager()
    ->createQueryBuilder()
    ->select('sum(h.hours)')
    ->from('ActGoodCommunityBundle:GroupReporting','h')
    ->where('h.group = :groupId') 
    ->andWhere('h.start >= :start') 
    ->andWhere('h.end <= :end')   
    ->setParameters([
      'groupId' => $group->getId(),
      'start' => $start->format('Y-m-d H:i:s'),
      'end' => $end->format('Y-m-d H:i:s')
    ])
    ->getQuery()
    ->getSingleScalarResult();

Group is defined in GroupReporting here:

/**
 * @ORM\JoinColumn(name="group_id", referencedColumnName="group_id")
 */  
private $group;

Since this last worked, I've both migrated servers and updated Symfony from 2.2 to 2.8. I've tried clearing cache, checked that orm's auto mapping is on. I think it might be something to do with the join column's syntax - maybe something that changed between the two versions? I've tried adding this:

@OneToOne(targetEntity="Group")

Any ideas?

0

There are 0 best solutions below