PHP code example of pierstoval / character-manager
1. Go to this page and download the library: Download pierstoval/character-manager 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/ */
pierstoval / character-manager example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// Sorry for the very long name.
new Pierstoval\Bundle\CharacterManagerBundle\PierstovalCharacterManagerBundle(),
];
}
}
namespace App\Entity;
use Pierstoval\Bundle\CharacterManagerBundle\Model\CharacterInterface;
class Character implements CharacterInterface
{
// Implement interface methods
}
namespace App\Step;
use Pierstoval\Bundle\CharacterManagerBundle\Action\AbstractStepAction;
use Symfony\Component\HttpFoundation\Response;
class Step1 extends AbstractStepAction
{
/**
* {@inheritdoc}
*/
public function execute(): Response
{
// Implement your step logic here.
return new Response('This step is now rendered');
}
}
/** @var $this \Pierstoval\Bundle\CharacterManagerBundle\Action\AbstractStepAction */
// Get the character property for specified step name (or current step by default)
$this->getCharacterProperty($stepName = null);
// Returns a RedirectResponse object to the next step
$this->nextStep();
// Returns a RedirectResponse object to the specified step, but by number, not by name
$this->goToStep($stepNumber);
// A cool tool to use flash messages. By default, the "type" is "error".
// All flash messages are translated and the translation domain is set in the StepAction::$translationDomain static property.
// Of course you can override the translation domain if you create your own abstract StepAction class and override this var.
$this->flashMessage($msg, $type = null, array $msgParams = []);
// Updates the current character step value and sets it to $value
// This is the method that makes sure that "onchange_clear" steps are cleared with a simple "unset()" in the session
$this->updateCharacterStep($value);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.