protected function createView($action = 'view') { $controller = \Staq\Util::getStackSubQuery($this); $view = (new \Stack\View())->byName($action, $controller); $view['controller'] = $controller; $view['controllerAction'] = $action; return $view; }
public function __construct() { $this->settings = (new \Stack\Setting())->parse($this); $this->name = strtolower(\Staq\Util::getStackSubQuery($this, '_')); $this->table = $this->settings->get('database.table', $this->name); $this->idField = $this->settings['database.idField']; $this->fields = $this->settings->getAsArray('database.fields'); }
protected function newEntity() { $class = 'Stack\\Entity'; $subQuery = \Staq\Util::getStackSubQuery($this); if ($subQuery) { $class .= '\\' . $subQuery; } return new $class(); }
public function __construct() { $settings = (new \Stack\Setting())->parse($this); $this->name = \Staq\Util::getStackSubQuery($this, '_'); $this->folder = '/data/' . $this->name; if (isset($settings['idField'])) { $this->idField = $settings['idField']; } }
public function getRoute($controller, $action) { if (is_object($controller)) { $controller = \Staq\Util::getStackSubQuery($controller); } if (isset($this->routes[$controller][$action])) { return $this->routes[$controller][$action]; } }
public static function findTemplate($stack, $action = NULL) { $template = strtolower(\Staq\Util::getStackSubQuery($stack, '/')) . '.twig'; $template = str_replace('_', '/', $template); if (!empty($action)) { $template = $action . '/' . $template; } $folder = strtolower(\Staq\Util::getStackType($stack)); while (TRUE) { if (\Staq::App()->getFilePath('template/' . $folder . '/' . $template)) { break; } if (\UString::has($template, '/')) { $template = \UString::substrBeforeLast($template, '/') . '.twig'; } else { $template = 'index.twig'; break; } } return $folder . '/' . $template; }
public function __toString() { $str = 'Route( ' . $this->uri . ' => '; if (is_array($this->callable)) { $controller = $this->callable[0]; if (\Staq\Util::isStack($controller)) { $str .= \Staq\Util::getStackSubQuery($controller); } else { $str .= \UObject::convertToClass($controller); } $str .= '::' . $this->callable[1]; } else { $str .= 'anonymous'; } return $str . ' )'; }
protected function getModel() { $modelClass = 'Stack\\Model\\' . \Staq\Util::getStackSubQuery($this); return new $modelClass(); }
public static function getStackSubQueryText($stack) { $subQuery = \Staq\Util::getStackSubQuery($stack); return str_replace(['\\', '_'], ' ', $subQuery); }