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); $view = $container->inflector->pluralize($view); $classname = $container->getNamespacePrefix($section) . 'Model\\' . ucfirst($view); $scaffolding = new ModelBuilder($container); $scaffolding->setSection($section); if (!$scaffolding->make($classname, $view)) { throw new \RuntimeException("An error occurred while creating the Model class"); } }