Skip to content
Christian Münch edited this page Jun 15, 2013 · 4 revisions

Helpers

The Symfony Framework offers a Helper System. http://symfony.com/doc/current/components/console/introduction.html#console-helpers

n98-magerun comes with a list of special helpers for the command line.

Parameter Helper

Ask Store

Evaluates the parameter "store". As third parameter you can specify a different argument name if it's not the recommended name "store".

$this->getHelper('parameter')->askStore($input, $output);

Ask for website

$this->getHelper('parameter')->askWebsite($input, $output);

Ask for Email

$this->getHelper('parameter')->askEmail($input, $output);

Ask for Password

$this->getHelper('parameter')->askPassword($input, $output);

Table Helper

$table = array();
$table[] = ('line' => '1', 'firstname' => 'Peter');
$table[] = ('line' => '2', 'firstname' => 'Lena');
$this->getHelper('table')->write($output, $table);

TwigHelper

Renders a Twig Template. See Twig for configuration options.

$this->getHelper('twig')->render('template_name.twig', array('var1' => 'value1');
Clone this wiki locally