public static function factory($model) { $paths = static::service('paths'); $paths->setModel($model); $relations = new self(); $relations->setRelationsTree($paths->relationsTree())->setRelationsTreeIndex($paths->relationsTreeIndex()); $relations->load(); return $relations; }