getData() 공개 메소드

获取对象原始数据 如果不存在指定字段返回false
public getData ( string $name = null ) : mixed
$name string 字段名 留空获取全部
리턴 mixed
예제 #1
0
 /**
  * 一对一 关联模型预查询拼装
  * @access public
  * @param string    $model 模型名称
  * @param string    $relation 关联名
  * @param Model     $result 模型对象实例
  * @return void
  */
 protected function match($model, $relation, &$result)
 {
     // 重新组装模型数据
     foreach ($result->getData() as $key => $val) {
         if (strpos($key, '__')) {
             list($name, $attr) = explode('__', $key, 2);
             if ($name == $relation) {
                 $list[$name][$attr] = $val;
                 unset($result->{$key});
             }
         }
     }
     $result->setAttr($relation, !isset($list[$relation]) ? null : (new $model($list[$relation]))->isUpdate(true));
 }