public function __construct() { $loader = new Twig_Loader_Filesystem(__DIR__ . '/../views'); $this->twig = new Twig_Environment($loader); $connect = SinglePdoConnect::getInstance(); ActiveRecord::setPDO($connect); }
public function actionIndex() { $connect = SinglePdoConnect::getInstance(); $tablesData = new TablesData($connect); $exist = $tablesData->checkTablesExist(['transport', 'passport', 'vendor', 'properties', 'transport_properties']); if (is_array($exist)) { $template = $this->twig->loadTemplate('index/tables_not_exist.tpl'); echo $template->render(array('messages' => $exist)); return false; } $vendors = new Vendor(); $vendors = $vendors->findAll(); $template = $this->twig->loadTemplate('index/_item_vendor.tpl'); echo $template->render(array('models' => $vendors)); $properties = new Properties(); $properties = $properties->findAll(); $template = $this->twig->loadTemplate('index/_item_properties.tpl'); echo $template->render(array('models' => $properties)); $transports = new Transport(); $transports = $transports->findAll(); $template = $this->twig->loadTemplate('index/_item_transports.tpl'); echo $template->render(array('models' => $transports)); }