FOF30\Generator\Command\Generate\Controller\Controller::execute PHP Method

execute() public method

public execute ( )
    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");
        }
    }

Usage Example

Esempio n. 1
0
File: Mvc.php Progetto: akeeba/fof
 public function execute()
 {
     $controller = new Controller($this->composer, $this->input);
     $controller->execute();
     $controller = new Model($this->composer, $this->input);
     $controller->execute();
     $controller = new View($this->composer, $this->input);
     $controller->execute();
 }
Controller