summaryrefslogtreecommitdiff
path: root/framework/Wsat/TWsatBaseGenerator.php
diff options
context:
space:
mode:
authorDaniel <darthdaniel85@gmail.com>2015-01-27 15:32:51 -0500
committerDaniel <darthdaniel85@gmail.com>2015-01-27 15:32:51 -0500
commit7f22a44867fdf10d2383595e6467923fd11e2b89 (patch)
treee6122d8ada3799ff042cf5f7ac236e367645efc2 /framework/Wsat/TWsatBaseGenerator.php
parent7b843cc7df910a218272f328293f2541d53c23b2 (diff)
Scaffolding 20%
Diffstat (limited to 'framework/Wsat/TWsatBaseGenerator.php')
-rw-r--r--framework/Wsat/TWsatBaseGenerator.php109
1 files changed, 56 insertions, 53 deletions
diff --git a/framework/Wsat/TWsatBaseGenerator.php b/framework/Wsat/TWsatBaseGenerator.php
index 1facb13f..763836a3 100644
--- a/framework/Wsat/TWsatBaseGenerator.php
+++ b/framework/Wsat/TWsatBaseGenerator.php
@@ -14,66 +14,69 @@ Prado::using('System.Data.Common.TDbMetaData');
class TWsatBaseGenerator
{
- /**
- * @return TDbMetaData for retrieving metadata information, such as
- * table and columns information, from a database connection.
- */
- protected $_dbMetaData;
+ /**
+ * @return TDbMetaData for retrieving metadata information, such as
+ * table and columns information, from a database connection.
+ */
+ protected $_dbMetaData;
- /**
- * Output folder where AR classes will be saved.
- */
- protected $_opFile;
+ /**
+ * Output folder where AR classes will be saved.
+ */
+ protected $_opFile;
- function __construct()
- {
- if (!class_exists("TActiveRecordManager", false))
- throw new Exception("You need to enable the ActiveRecord module in your application configuration file.");
- $ar_manager = TActiveRecordManager::getInstance();
- $_conn = $ar_manager->getDbConnection();
- $_conn->Active = true;
- $this->_dbMetaData = TDbMetaData::getInstance($_conn);
- }
+ function __construct()
+ {
+ if (!class_exists("TActiveRecordManager", false))
+ throw new Exception("You need to enable the ActiveRecord module in your application configuration file.");
+ $ar_manager = TActiveRecordManager::getInstance();
+ $_conn = $ar_manager->getDbConnection();
+ $_conn->Active = true;
+ $this->_dbMetaData = TDbMetaData::getInstance($_conn);
+ }
- public function setOpFile($op_file_namespace)
- {
- $op_file = Prado::getPathOfNamespace($op_file_namespace);
- if (empty($op_file))
- throw new Exception("You need to fix your output folder namespace.");
- if (!is_dir($op_file))
- mkdir($op_file, 0777, true);
- $this->_opFile = $op_file;
- }
+ public function setOpFile($op_file_namespace)
+ {
+ $op_file = Prado::getPathOfNamespace($op_file_namespace);
+ if (empty($op_file))
+ throw new Exception("You need to fix your output folder namespace.");
+ if (!is_dir($op_file))
+ mkdir($op_file, 0777, true);
+ $this->_opFile = $op_file;
+ }
- public function renderAllTablesInformation()
+ public function renderAllTablesInformation()
+ {
+ foreach ($this->getAllTableNames() as $table_name)
{
- foreach ($this->getAllTableNames() as $table_name)
- {
- echo $table_name . "<br>";
- $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
- echo "Table info:" . "<br>";
- echo "<pre>";
- print_r($tableInfo);
- echo "</pre>";
- }
+ echo $table_name . "<br>";
+ $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
+ echo "Table info:" . "<br>";
+ echo "<pre>";
+ print_r($tableInfo);
+ echo "</pre>";
}
+ }
- public function getAllTableNames()
- {
- $tableNames = $this->_dbMetaData->findTableNames();
- $index = array_search('pradocache', $tableNames);
- if($index)
- array_splice($tableNames, $index, 1);
- return $tableNames;
- }
+ public function getAllTableNames()
+ {
+ $tableNames = $this->_dbMetaData->findTableNames();
+ $index = array_search('pradocache', $tableNames);
+ if ($index)
+ array_splice($tableNames, $index, 1);
+ return $tableNames;
+ }
- public static function pr($data)
- {
- echo "<pre>";
- print_r($data);
- echo "</pre>";
- }
+ public static function pr($data)
+ {
+ echo "<pre>";
+ print_r($data);
+ echo "</pre>";
+ }
-}
+ protected function eq($data)
+ {
+ return '"' . $data . '"';
+ }
-?>
+}