示例#1
0
文件: Model.php 项目: fnu/php-orm
 public function toExtends()
 {
     $extends = $this->getClassExtends();
     if (\G\Conf::get('orm.model.extend')) {
         array_unshift($extends, \G\Conf::get('orm.model.extend'));
     }
     return empty($extends) ? '' : ' extends ' . implode(', ', $extends);
 }
示例#2
0
文件: Tab.php 项目: fnu/php-orm
 /**
  * 生成源代码
  *
  * @return string  Model的源代码
  */
 public function toModelCode()
 {
     $code = "<?php\n\n";
     $code .= $this->toNamespace();
     $code .= "use " . \G\Conf::get('orm.model.use') . ";\n";
     $code .= "\n";
     $code .= "/**\n";
     $code .= " * 数据模型\n";
     $code .= " * {$this->getTableComment()}\n";
     $code .= " * Table: {$this->getTableName()}\n";
     $code .= " */\n";
     $code .= "class {$this->getBaseModelName()} extends " . \G\Conf::get('orm.model.extend') . "\n";
     $code .= "{\n";
     $code .= $this->toAttributes();
     $code .= "\n";
     $code .= $this->toMethod();
     $code .= "}\n";
     return $code;
 }