示例#1
0
文件: model.php 项目: hracsi/HMVC
 public function __construct($model = null)
 {
     $this->_model = Inflector::makeModelName(get_class($this));
     $this->_table = Inflector::makeSqlTableName($this->_model);
     $this->data = '';
     $this->fields = array();
     $this->key = '';
     $this->keyValue = null;
 }
示例#2
0
文件: sqlaaom.php 项目: hracsi/HMVC
 /**
  * SqlAaom::makingConnections()
  * 
  * @param array $array The $connections of the tables.
  * @return string The extra conditions for WHERE.
  */
 protected function makingConnections($array)
 {
     $tables = array();
     foreach ($array as $key => $value) {
         if (!in_array(self::getTableNameFromData($key), $tables)) {
             array_push($tables, self::getTableNameFromData($key));
         }
         if (!in_array(self::getTableNameFromData($value), $tables)) {
             array_push($tables, self::getTableNameFromData($value));
         }
     }
     $extTables = $tables;
     foreach ($tables as $table) {
         $t = Inflector::makeModelName($table);
         $t = new $t();
         $t = $t->getConnections();
         foreach ($t as $key => $value) {
             if (!in_array(self::getTableNameFromData($key), $extTables)) {
                 array_push($extTables, self::getTableNameFromData($key));
             }
             if (!in_array(self::getTableNameFromData($value), $extTables)) {
                 array_push($extTables, self::getTableNameFromData($value));
             }
         }
     }
     $where = '';
     foreach ($extTables as $table) {
         $t = Inflector::makeModelName($table);
         $t = new $t();
         $t = $t->getConnections();
         foreach ($t as $key => $value) {
             $where .= $key . ' = ' . $value . ' AND ';
         }
     }
     return substr($where, 0, strlen($where) - 5);
 }
示例#3
0
 public function set($model, $name, $value)
 {
     if ($model) {
         $model = Inflector::makeModelName(get_class($this));
         $this->_view->set($model, $name, $value);
     } else {
         $this->_view->set(0, $name, $value);
     }
 }