public function execute()
{
// Backend or frontend?
$section = $this->input->get('frontend', false) ? 'site' : 'admin';
$view = $this->getViewName($this->input);
// Let's force the use of the Magic Factory
$container = Container::getInstance($this->component, array('factoryClass' => 'FOF30\\Factory\\MagicFactory'));
$container->factory->setSaveScaffolding(true);
// plural / singular
$view = $container->inflector->singularize($view);
$classname = $container->getNamespacePrefix($section) . 'Controller\\' . ucfirst($view);
$scaffolding = new ControllerBuilder($container);
$scaffolding->setSection($section);
if (!$scaffolding->make($classname, $view)) {
throw new \RuntimeException("An error occurred while creating the Controller class");
}
}