public function actionUpdate($id) { $properties = new Properties(); $properties = $properties->find($id); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $properties = $properties->fromArray($_POST); $properties->save(); header('Location: /'); } else { $template = $this->twig->loadTemplate('properties/update.tpl'); echo $template->render(array('model' => $properties, 'types' => Properties::getTypes())); } }