prisma-client-php 2.0.2 → 2.0.3

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.
@@ -906,13 +906,26 @@ final class PPHPUtility
906
906
  $modelFieldData[$modelClass->_primaryKey] = $existingParent->{$modelClass->_primaryKey};
907
907
  }
908
908
 
909
+ $relatedId = $relatedFieldData[$relatedClass->_primaryKey];
910
+ $modelId = $modelFieldData[$modelClass->_primaryKey];
911
+
912
+ $implicit = self::compareStringsAlphabetically($modelRelatedFieldType, $modelName);
913
+
914
+ if ($implicit['A'] === $modelName) {
915
+ $idA = $modelId;
916
+ $idB = $relatedId;
917
+ } else {
918
+ $idA = $relatedId;
919
+ $idB = $modelId;
920
+ }
921
+
909
922
  $relatedResult = self::handleImplicitRelationInsert(
910
923
  $modelName,
911
924
  $modelRelatedFieldType,
912
925
  $dbType,
913
926
  $pdo,
914
- $relatedFieldData[$relatedClass->_primaryKey],
915
- $modelFieldData[$modelClass->_primaryKey],
927
+ $idA,
928
+ $idB
916
929
  );
917
930
  } else {
918
931
  if (!$modelRelatedFieldIsList && count($operations) > 1) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prisma-client-php",
3
3
  "description": "Prisma Client PHP is an auto-generated query builder that enables type-safe database access in PHP.",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {