Наследование: extends BaseFactory
Пример #1
0
 /**
  * Create a new View object
  *
  * @param   string  $viewName  The name of the view we're getting a View object for.
  * @param   string  $viewType  The type of the View object. By default it's "html".
  * @param   array   $config    Optional MVC configuration values for the View object.
  *
  * @return  View
  */
 public function view($viewName, $viewType = 'html', array $config = array())
 {
     try {
         return parent::view($viewName, $viewType, $config);
     } catch (ViewNotFound $e) {
         $magic = new Magic\ViewFactory($this->container);
         return $magic->make($viewName, $viewType, $config);
     }
 }
Пример #2
0
 /**
  * Make a new scaffolding document
  *
  * @param   string  $requestedClass     The requested class, with full qualifier ie Myapp\Site\Controller\Foobar
  * @param   string  $viewName           The name of the view linked to this controller
  * @param   string  $viewType           The type of the view linked to this controller
  *
  * @return  bool    True on success, false otherwise
  */
 public function make($requestedClass, $viewName, $viewType)
 {
     // Class already exists? Stop here
     if (class_exists($requestedClass)) {
         return true;
     }
     // I have to magically create the controller class
     $magic = new ViewFactory($this->container);
     $magic->setSection($this->getSection());
     $fofView = $magic->make($viewName, $viewType);
     /** @var ErectorInterface $erector */
     $erector = new ViewErector($this, $fofView, $viewName, $viewType);
     $erector->setSection($this->getSection());
     $erector->build();
     if (!class_exists($requestedClass)) {
         return false;
     }
     return true;
 }
Пример #3
0
 /**
  * Create a new View object
  *
  * @param   string  $viewName  The name of the view we're getting a View object for.
  * @param   string  $viewType  The type of the View object. By default it's "html".
  * @param   array   $config    Optional MVC configuration values for the View object.
  *
  * @return  View
  */
 public function view($viewName, $viewType = 'html', array $config = array())
 {
     try {
         return parent::view($viewName, $viewType, $config);
     } catch (ViewNotFound $e) {
         $magic = new Magic\ViewFactory($this->container);
         // Let's pass the section override (if any)
         $magic->setSection($this->getSection());
         return $magic->make($viewName, $viewType, $config);
     }
 }