create-prisma-php-app 1.16.29 → 1.16.31

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.
@@ -26,7 +26,9 @@ $isAjax = isAjaxRequest();
26
26
  $isWire = isWireRequest();
27
27
  $contentType = $_SERVER['CONTENT_TYPE'] ?? '';
28
28
  $requestedWith = $_SERVER['HTTP_X_REQUESTED_WITH'] ?? '';
29
- $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
29
+ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
30
+ (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ||
31
+ $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
30
32
  $domainName = $_SERVER['HTTP_HOST'];
31
33
  $scriptName = dirname($_SERVER['SCRIPT_NAME']) . '/';
32
34
  $baseUrl = $protocol . $domainName . rtrim($scriptName, '/') . '/src/app/';
@@ -248,13 +248,19 @@ abstract class Utility
248
248
  case 'endsWith':
249
249
  case 'equals':
250
250
  case 'not':
251
- $validatedValue = Validator::string($val);
252
- $likeOperator = $condition === 'contains' ? ($dbType == 'pgsql' ? 'ILIKE' : 'LIKE') : '=';
253
- if ($condition === 'startsWith') $validatedValue .= '%';
254
- if ($condition === 'endsWith') $validatedValue = '%' . $validatedValue;
255
- if ($condition === 'contains') $validatedValue = '%' . $validatedValue . '%';
256
- $sqlConditions[] = $condition === 'not' ? "$fieldQuoted != $bindingKey" : "$fieldQuoted $likeOperator $bindingKey";
257
- $bindings[$bindingKey] = $validatedValue;
251
+ if ($val === null) {
252
+ $sqlConditions[] = "$fieldQuoted IS NOT NULL";
253
+ } elseif ($val === '') {
254
+ $sqlConditions[] = "$fieldQuoted != ''";
255
+ } else {
256
+ $validatedValue = Validator::string($val);
257
+ $likeOperator = $condition === 'contains' ? ($dbType == 'pgsql' ? 'ILIKE' : 'LIKE') : '=';
258
+ if ($condition === 'startsWith') $validatedValue .= '%';
259
+ if ($condition === 'endsWith') $validatedValue = '%' . $validatedValue;
260
+ if ($condition === 'contains') $validatedValue = '%' . $validatedValue . '%';
261
+ $sqlConditions[] = $condition === 'not' ? "$fieldQuoted != $bindingKey" : "$fieldQuoted $likeOperator $bindingKey";
262
+ $bindings[$bindingKey] = $validatedValue;
263
+ }
258
264
  break;
259
265
  case 'gt':
260
266
  case 'gte':
@@ -270,7 +276,6 @@ abstract class Utility
270
276
  $inPlaceholders = [];
271
277
  foreach ($val as $i => $inVal) {
272
278
  $inKey = $bindingKey . "_" . $i;
273
- // Assuming the values are strings; adjust validation as necessary.
274
279
  $validatedValue = Validator::string($inVal);
275
280
  $inPlaceholders[] = $inKey;
276
281
  $bindings[$inKey] = $validatedValue;
@@ -285,12 +290,16 @@ abstract class Utility
285
290
  }
286
291
  }
287
292
  } else {
288
- // For scalar non-array values; direct equals condition assumed
289
- $bindingKey = ":" . $prefix . $key . $level;
290
- // Use appropriate validation based on expected type; assuming string for simplicity
291
- $validatedValue = Validator::string($value);
292
- $sqlConditions[] = "$fieldQuoted = $bindingKey";
293
- $bindings[$bindingKey] = $validatedValue;
293
+ if ($value === null) {
294
+ $sqlConditions[] = "$fieldQuoted IS NULL";
295
+ } elseif ($value === '') {
296
+ $sqlConditions[] = "$fieldQuoted = ''";
297
+ } else {
298
+ $bindingKey = ":" . $prefix . $key . $level;
299
+ $validatedValue = Validator::string($value);
300
+ $sqlConditions[] = "$fieldQuoted = $bindingKey";
301
+ $bindings[$bindingKey] = $validatedValue;
302
+ }
294
303
  }
295
304
  }
296
305
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.16.29",
3
+ "version": "1.16.31",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",