Skip to content

Commit 52025ec

Browse files
committed
Fixed update
1 parent e328a62 commit 52025ec

5 files changed

Lines changed: 12 additions & 4 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "interaapps/uloleorm",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"type": "library",
55
"authors": [
66
{

de/interaapps/ulole/orm/ORMModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function save(string $database = 'main'): bool {
2525
if (isset($this->{$fieldName}))
2626
$query->set($modelInformation->getFieldName(), $this->{$fieldName});
2727
}
28-
return $query->where(UloleORM::getModelInformation(static::class)->getIdentifier(), UloleORM::getModelInformation(static::class)->getIdentifierValue())->update() !== false;
28+
return $query->where(UloleORM::getModelInformation(static::class)->getIdentifier(), UloleORM::getModelInformation(static::class)->getIdentifierValue($this))->update() !== false;
2929
} else {
3030
return $this->insert($database);
3131
}

de/interaapps/ulole/orm/UloleORM.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,18 @@ public static function getTableName($modelClazz): string {
6868
return self::$modelInformation[$modelClazz]->getName();
6969
}
7070

71+
/**
72+
* @param $model
73+
* @return ModelInformation
74+
* @throws Null
75+
*/
7176
public static function getModelInformation($model): ModelInformation {
77+
if (!isset(self::$modelInformation[$model]))
78+
throw new \Exception("Register the model first with UloleORM::register(".$model."::class);");
7279
return self::$modelInformation[$model];
7380
}
7481

82+
7583
public static function getAttributesEnabled(): bool {
7684
return self::$attributesEnabled;
7785
}

de/interaapps/ulole/orm/migration/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Column {
88
private bool $ai = false;
99
private bool $unique = false;
1010
private bool $primary = false;
11-
private string|int|null $size; // Can also be value
11+
private mixed $size; // Can also be value
1212
private mixed $default;
1313
private bool $nullable = true;
1414
private string|null $renameTo = null;

uppm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uloleorm",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"repositories": [],
55
"run": {},
66
"build": {},

0 commit comments

Comments
 (0)