PHP code example of ibrows / wizard-annotation-bundle
1. Go to this page and download the library: Download ibrows/wizard-annotation-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ibrows / wizard-annotation-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Ibrows\Bundle\WizardAnnotationBundle\IbrowsWizardAnnotationBundle(),
);
}
php
namespace YourApp\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Ibrows\Bundle\WizardAnnotationBundle\Annotation\Wizard;
/**
* @Route("/wizard")
*/
class WizardController extends Controller
{
/**
* @Route("/register", name="wizard_register")
* @Template
* @Wizard(name="register", number=1)
* @return array
*/
public function registerAction()
{
return array();
}
/**
* @Route("/address", name="wizard_address")
* @Template
* @Wizard(name="address", number=2, validationMethod="addressValidation")
* @return array
*/
public function addressAction()
{
return array();
}
/**
* @return bool
*/
public function addressValidation()
{
/**
* Do your checks if this step is valid and return a Response/RedirectResponse or Wizard::REDIRECT_STEP_BACK
* if something is wrong. Otherwise return true
*/
if(!$this->getUser()){
return Wizard::REDIRECT_STEP_BACK;
}
return true;
}
/**
* @Route("/summary", name="wizard_summary")
* @Template
* @Wizard(name="summary", number=3, validationMethod="summaryValidation")
* @return array
*/
public function summaryAction()
{
return array();
}
/**
* @return bool
*/
public function summaryValidation()
{
/**
* Do your checks if this step is valid and return a Response/RedirectResponse or Wizard::REDIRECT_STEP_BACK
* if something is wrong. Otherwise return true
*/
if(!$this->someCheck()){
return new RedirectResponse($this->generateUrl('index'));
}
if(!$this->someOtherCheck()){
return new RedirectResponse($this->generateUrl('login'));
}
return true;
}
/**
* @Route("/display", name="wizard_display")
* @Template
* @return array
*/
public function displayAction()
{
return array(
'wizard' => $this->get('ibrows_wizardannotation.annotation.handler')
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.