I'm having trouble converting sql to dql. This what I trying to achieve when the users are in activity table they should not be able to edit an inactive state but state is located in another table.
SQL
SELECT Activity1.Payrollperiodid, PayrollPeriod.state
FROM Activity1
INNER JOIN PayrollPeriod ON Activity1.payrollperiodid = Payrollperiod.payrollperiodid
where PayrollPeriod.state=1;
DQL
public function findBytransid($payrollperiodid)
{
$repository=$this->getEntityManager()->getRepository('comtwclagripayrollBundle:Activity');
$qb = $repository->createQueryBuilder('a');
$qb->select('a');
$qb->innerJoin('a.payrollperiodid', 'p');
$qb->where('a.payrollperiodid=:payrollperiodid and a.status=:1');
$qb->setParameter('payrollperiodid', $payrollperiodid);
$qb->setParameter('status', 1);
return $results = $qb->getQuery()->getResult();