/** * Converts PHP representation to the SQL value. * * @param Point $value specific point * @param AbstractPlatform $platform DB platform * * @return string */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (!$value) { return; } return sprintf('(%F,%F,%F)', $value->getLatitude(), $value->getLongitude(), $value->getHeight()); }
public function yamapsAction(Request $request) { $addClick = false; // добавление точки с карты if (isset($_GET['addclick'])) { $addClick = true; if (isset($_POST['title'])) { $lat = $_POST['lat']; $long = $_POST['long']; $height = 0; $title = $_POST['title']; $newp = new Points(); $newp->setTitle($title); $pp = new Point(); $result = $pp->setFromLLH($lat, $long, $height); $repository = $this->getDoctrine()->getRepository('GeoDataBundle:Points'); $newp->setPoint($pp); $em = $this->getDoctrine()->getEntityManager(); $em->persist($newp); $em->flush(); echo "Добавление точки <b>{$title}</b> успешно выполнено"; exit; } } $pts = $this->getDoctrine()->getRepository('GeoDataBundle:Points')->findAll(); $param['points'] = $pts; // настраиваем параметры $param['div'] = "map_canvas"; $param['func'] = "initialize"; $visualMap = new VisualMap($param); if (!$addClick) { $script = $visualMap->getYandexMap(); } else { $script = $visualMap->getYandexAddPointVidget(); } return $this->render('GeoDataBundle:Default:yamaps.html.twig', array('yaScript' => $script, 'func' => $param['func'], 'pts' => $pts, 'addClick' => $addClick)); }