Skip to content

Instantly share code, notes, and snippets.

@makasim
Created July 18, 2011 14:42
Show Gist options
  • Save makasim/1089711 to your computer and use it in GitHub Desktop.
Save makasim/1089711 to your computer and use it in GitHub Desktop.
wizard controller
<?php
// Controller
namespace Rj\EmployerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class AdWizardController extends Controller
{
public function showStep($identifier)
{
//http://symfony.com/doc/2.0/book/translation.html
return new Response($this->renderStep($this->getWizard()->step($identifier)));
}
public function processStep($identifier)
{
$step = $this->getWizard()->step($identifier);
$step->process();
if ($step->finished()) {
$step = $this->getWizard()->nextFor($identifier);
}
$this->redirect('rj_employer_wizard_show_step', array('identifier' => $step->getIdentifier()));
}
protected function renderStep($step)
{
return $this->renderView($step->getTemplate(), array('step' => $step));
}
protected function getWizard()
{
return $this->get('rj_employer_ad_wizard');
}
}
// DIC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment