示例#1
0
文件: Tree.php 项目: mightydes/enjoin
 /**
  * Tree constructor.
  * @param Model $Model
  * @param array $params
  */
 public function __construct(Model $Model, array $params)
 {
     $this->tree = $this->createNode($Model, $params);
     $this->hasChildren = count($this->tree->children) > 0;
     $this->hasLimit = isset($params['limit']);
     if ($this->hasChildren && Factory::getConfig()['enjoin']['auto_require']) {
         $this->walk(function (stdClass $node, array $path) {
             if (count($path) - 1) {
                 if ($node->where && is_null($node->required)) {
                     $node->required = true;
                 }
             }
         });
     }
 }
示例#2
0
 /**
  * @param string $modelName
  * @return string
  */
 public static function getModelDefinitionClass($modelName)
 {
     return Factory::getConfig()['enjoin']['models_namespace'] . '\\' . str_replace('.', '\\', $modelName);
 }