$er->createQueryBuilder('d')
->innerJoin('ShopCreateBundle:ShopsDelivery', 'sd', 'WITH', 'sd.delivery = d.id')
->innerJoin('sd.shops', 's')
->where('s.id = :id')
->setParametr('id', $id);