Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
BaseControllerCreator.php
Go to the documentation of this file.
1<?php
3
4use Ubiquity\scaffolding\ScaffoldController;
8
19abstract class BaseControllerCreator extends HasUsesTrait {
20
21 protected $controllerName;
22
23 protected $routePath;
24
25 protected $views;
26
27 protected $controllerNS;
28
29 protected $templateName;
30
32
38
40 $this->controllerName = $controllerName;
41 if ($routePath != null) {
42 $this->routePath = '/' . \ltrim($routePath, '/');
43 }
44 $this->views = $views;
45 $this->controllerNS = Startup::getNS("controllers");
46 $this->useViewInheritance=$useViewInheritance;
47 }
48
49 protected function getNamespaceStr(){
50 if($this->controllerNS==null){
51 return '';
52 }
53 return 'namespace '. \trim($this->controllerNS,'\\').';';
54 }
55
56 protected function getRouteAnnotation($path, $automated=true, $inherited=true) {
57 return CacheManager::getAnnotationsEngineInstance()->getAnnotation($this, 'route', [
58 'path' => $path,
59 'automated' => $automated,
60 'inherited' => $inherited
61 ])->asAnnotation();
62 }
63
64 protected function getAnnotation(string $type,array $attributes){
65 return CacheManager::getAnnotationsEngineInstance()->getAnnotation($this, $type, $attributes)->asAnnotation();
66 }
67
68 abstract public function create(ScaffoldController $scaffoldController);
69
70 abstract protected function addViews(&$messages, &$classContent);
71
76 public function getTemplateName() {
78 }
79
84 public function setTemplateName($templateName) {
85 $this->templateName = $templateName;
86 }
87}
88
Manager for caches (Router, Rest, models).
Starts the framework.
Definition Startup.php:19
create(ScaffoldController $scaffoldController)
__construct($controllerName, $routePath, $views, $useViewInheritance)
getRouteAnnotation($path, $automated=true, $inherited=true)