em = $em; $this->geofence_flag = $geofence_flag; } public function isCovered($long, $lat) { // check if geofence is enabled if ($this->geofence_flag == 'true') { // see if the point is in any of the polygons $query = $this->em->createQuery('SELECT count(s) from App\Entity\SupportedArea s where st_contains(s.coverage_area, point(:long, :lat)) = true') ->setParameter('long', $long) ->setParameter('lat', $lat); // number of polygons that contain the point $count = $query->getSingleScalarResult(); if ($count > 0) return true; return false; } return true; } }