create-prisma-php-app 1.8.11 → 1.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prisma/seed.js +13 -0
- package/dist/src/app/api/api.php +17 -2
- package/package.json +1 -1
package/dist/prisma/seed.js
CHANGED
|
@@ -50,6 +50,19 @@ async function main() {
|
|
|
50
50
|
// await prisma.user.deleteMany();
|
|
51
51
|
// await prisma.user.createMany({ data: userData });
|
|
52
52
|
// ========================================
|
|
53
|
+
// Code for SQLite
|
|
54
|
+
// ========================================
|
|
55
|
+
// UserRole
|
|
56
|
+
// ----------------------------------------
|
|
57
|
+
// await prisma.userRole.deleteMany();
|
|
58
|
+
// await prisma.userRole.createMany({ data: userRoleData });
|
|
59
|
+
// SQLite automatically handles ID incrementation and does not require manual sequence reset
|
|
60
|
+
// ----------------------------------------
|
|
61
|
+
// User
|
|
62
|
+
// ----------------------------------------
|
|
63
|
+
// await prisma.user.deleteMany();
|
|
64
|
+
// await prisma.user.createMany({ data: userData });
|
|
65
|
+
// ========================================
|
|
53
66
|
// Code for MongoDB
|
|
54
67
|
// ----------------------------------------
|
|
55
68
|
// UserRole
|
package/dist/src/app/api/api.php
CHANGED
|
@@ -60,8 +60,8 @@ if (stripos($contentType, 'application/json') !== false) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Construct the full class name and check for class and property existence
|
|
63
|
-
$fullClassName = "Lib\\Prisma\\Classes\\" . $className;
|
|
64
|
-
if (!class_exists($fullClassName) || !property_exists(Prisma::class, $className)) {
|
|
63
|
+
$fullClassName = "Lib\\Prisma\\Classes\\" . pascalCase($className);
|
|
64
|
+
if (!class_exists($fullClassName) || !property_exists(Prisma::class, camelCase($className))) {
|
|
65
65
|
echo json_encode(['error' => "Error: Class $fullClassName not found or property $className not found in Prisma class!"]);
|
|
66
66
|
exit;
|
|
67
67
|
}
|
|
@@ -81,3 +81,18 @@ try {
|
|
|
81
81
|
} catch (\ArgumentCountError | \Exception $e) {
|
|
82
82
|
echo json_encode(['error' => "Error: " . $e->getMessage()]);
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
function camelCase($string)
|
|
86
|
+
{
|
|
87
|
+
$string = ucwords($string, "_");
|
|
88
|
+
$string = str_replace("_", "", $string);
|
|
89
|
+
$string = lcfirst($string);
|
|
90
|
+
return $string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function pascalCase($string)
|
|
94
|
+
{
|
|
95
|
+
$string = ucwords($string, "_");
|
|
96
|
+
$string = str_replace("_", "", $string);
|
|
97
|
+
return $string;
|
|
98
|
+
}
|