Пример #1
0
 /**
  * Обработка формы
  *
  * @param PlaceForm $form
  * @param sfWebRequest $request
  */
 protected function processForm(PlaceForm $form, sfWebRequest $request)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $place = $form->save();
         if ($request->isXmlHttpRequest()) {
             $place = PlaceTable::getInstance()->queryWithCount(null, 'e')->where('e.id = ?', $place->id)->fetchOne();
             return $this->renderPartial('place/show', array('place' => $place));
         } else {
             return $this->redirect('place_show', $place);
         }
     }
     return sfView::SUCCESS;
 }
Пример #2
0
 /**
  * Обновление записи
  *
  * @param array $values
  */
 protected function doUpdateObject($values)
 {
     // координаты объекта
     if ($values['gmap']) {
         $coords = explode(',', $values['gmap'], 2);
         if (count($coords) == 2) {
             $values['geo_lat'] = $coords[0];
             $values['geo_lng'] = $coords[1];
         }
     }
     parent::doUpdateObject($values);
 }