Example #1
0
 /**
  *
  * @param str $table_name
  * @param str $object_name
  * @param str $parent_object_name
  * @return ModelMaker
  */
 public function __construct($table_name, $object_name, $parent_object_name = null)
 {
     $this->table_name = $table_name;
     $this->object_name = $object_name;
     $this->parent_object_name = $parent_object_name;
     $this->config = Config::getInstance();
     //connect to database
     if (is_null(self::$pdo)) {
         self::$pdo = $this->connect();
     }
 }
Example #2
0
<?php

/*
 * Copyright 2014 Empodex PHP Framework.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @copyright 2014-2015 Empoddy Labs.
 * @author Prabhat Shankar <prabhat.singh88[at]gmail.com>
 */
chdir('..');
require_once 'init.php';
Loader::register(array(EFC_ROOT_PATH . 'makemodel/classes/'));
echo EFC_ROOT_PATH;
if ($_GET['table_name'] && $_GET['object_name']) {
    $object = new ModelMaker($_GET['table_name'], $_GET['object_name']);
    echo $object->makeModel();
} else {
    echo "Usage:\n    makemodel.php <table_name> <object_name> [<parent_object_name>]\n";
}