示例#1
0
 public function run()
 {
     $params = $this->_getClassMethodParam();
     $className = $params['Class'] . 'Controller';
     $fileClass = 'controllers/' . $className . '.php';
     if (file_exists($fileClass)) {
         require_once $fileClass;
         if (class_exists($className)) {
             $Controller = new $className();
             // create new Object
             if ($params['Method']) {
                 if (method_exists($Controller, $params['Method'])) {
                     $Controller->{$params['Method']}($params['Param']);
                     // execute method and parameters
                 } else {
                     PrintUtil::close("The method [{$params['Method']}] Does not exists in class [{$className}].");
                 }
             } else {
                 PrintUtil::close("There is no method in class [{$className}].");
             }
         } else {
             PrintUtil::close("The class [{$className}] Does not exists.");
         }
     } else {
         PrintUtil::close("The file [{$fileClass}] Does not exists.");
     }
 }
示例#2
0
 public function generate($entities)
 {
     PrintUtil::log("Generating sql scripts... ");
     $sql = "";
     foreach ($entities as $entity) {
         $sql .= $this->generateSql($entity) . "\n\n";
     }
     foreach (Singleton::create("ServiceBuilder")->getManyToManyMappingTables() as $table => $props) {
         $sql .= $this->generateMappingTable($table, $props);
     }
     FileUtil::storeFileContents("src/sql/tables.sql", $sql);
     $data = FileUtil::fileExists("src/sql/data.sql") ? FileUtil::getFileContents("src/sql/data.sql") : "";
     FileUtil::storeFileContents("src/sql/all.sql", $sql . $data);
     PrintUtil::logln("SQL scripts generated.");
 }
示例#3
0
 public function run()
 {
     //$this->_createNewMember();
     //$this->_updateMember();
     $Query = $this->model->query->select('first_name', 'last_name');
     //$Query->whereEQ('id', 1); // work
     $Query->whereEQ('first_name', 'Pao');
     // work
     $Query->whereEQ('last_name', 'IM', 'or');
     // work
     $Query->whereNEQ('id', 3);
     // work
     //$Query->whereNULL('first_name'); // need to test
     //$Query->whereNNULL('first_name'); //not work
     //$Query->whereNNULL('id'); // ot work
     $Query->orderBy(array('last_name' => 'Desc', 'first_name' => 'Asc'));
     //$Query->groupBy('FieldA', 'FieldB');
     //$Query->limit();
     $DataList = $Query->run();
     PrintUtil::display($DataList);
 }
示例#4
0
 public function __construct()
 {
     PrintUtil::log("Importing entities... ");
     $this->importEntities();
     PrintUtil::logln("Entities imported.");
 }
示例#5
0
function handleError($type, $msg, $file, $line, $context)
{
    PrintUtil::logln("[{$type}] {$msg} ({$file}:{$line})\n\n");
}