This commit is contained in:
2025-06-18 14:50:18 +03:00
parent a64ed080bb
commit 4c716a8a8c
160 changed files with 6786 additions and 23 deletions

View File

@ -644,4 +644,61 @@ class ModuleService
return true;
}
public function createCRUD(array $params, string $modulePath)
{
$slug = $params['slug'];
$model = $params['model'];
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/controllers/kernel_controller_template',
$modulePath . '/controllers/' . $model . 'Controller.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/models/model_template',
$modulePath . '/models/' . $model . '.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/models/forms/create_form_template',
$modulePath . '/models/forms/Create' . $model . 'Form.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/services/service_template',
$modulePath . '/services/' . $model . 'Service.php',
$params
);
mkdir($modulePath . '/views/' . strtolower($model));
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/index_template',
$modulePath . '/views/' . strtolower($model) . '/index.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/view_template',
$modulePath . '/views/' . strtolower($model) . '/view.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/form_template',
$modulePath . '/views/' . strtolower($model) . '/form.php',
$params
);
}
public function createController(array $params, string $path): void
{
$slug = $params['slug'];
$model = $params['model'];
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/controllers/kernel_controller_template',
$path . '/' . $model . 'Controller.php',
$params
);
}
}