How to show two tables data from my controller.

Here is my controller's code.

```
class TestController extends Controller
{
   public function showAction(Request $request)
   {
        $em = $this->getDoctrine()->getManager();
        $teacher = $this->getDoctrine()->getRepository(Teacher::class);

        $query = $em
        ->createQueryBuilder('t')
        ->from('AppBundle:Teacher','t')
        ->Join('AppBundle:Student','s')
        ->where('t.id=id and s.tid=tid')
        ->getQuery()
        ->getResult();
    }
}

```

When `print_r` it's showing only one table data.
Please help