Commit graph

11 commits

Author SHA1 Message Date
0cdb0e43a8
fix: expose Database property on Model as readonly public 2026-02-22 14:36:50 +01:00
fd0c8cbbcd fix: pass an optional return value to Database\Model->set() (#28)
This PR addresses a bug that can arise (for example) if an object is passed to a database column that accepts a string. Passing this object (or something else) to the `$return` parameter will return the value of that variable instead of the value of `$value`

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/28
2026-02-16 15:07:11 +01:00
19e15c0b23 fix: allow int type for abstract $id property in Database\Model (#27)
It's not guaranteed that the primary key ($id here) is a string. We primarily use UUIDs for the primary key, but it could also be an integer.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/27
2026-02-12 15:25:49 +01:00
d55ad999b3 refactor: move namespaces one level up (#18)
We're moving all classes one namespace layer up (with the exception for extending Database classes. This makes it less verbose and probably save a few seconds to type every time.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/18
2026-01-25 10:00:11 +01:00
be03b05191 fix: return passed value when setting db row value (#16)
Closes #14

From the example in the issue, this can now be fixed like this:
```php
final public DateTimeImmutable $date_created {
			get  => new DateTimeImmutable($this->get(Fields::DATE_CREATED->value));
			set (DateTimeImmutable $date_created) => new DateTimeImmutable(
			  $this->set(Fields::DATE_CREATED->value,
			  $date_created->format(Database::DATETIME_FORMAT)
			));
}
```

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/16
2025-12-01 13:56:42 +01:00
9517203418 feat: add database Controller class for manipulating entity data (#13)
This PR adds a new database boilerplate for manipulating data stored in a database through an instanced database Model. The only method implemented by this class so far is `Controller()->update()`. It can be used to patch column values for a database row given an instanced `vlw\Database\Model`. An associative array of column keys and values are then passed to the update method.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/13
2025-11-30 13:56:31 +01:00
00337cd3aa refactor: replace the Model->isset property with a public instance method (#9)
This change is primarily to accommodate the new `Reflect::serialize()` method since we don't want to include the isset property when returning serialized objects.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/9
2025-11-01 18:34:48 +01:00
b1bdf628f2 refactor: replace for() with from() in database Model (#7)
This PR replaces the `vlw\MySQL->for()` with `vlw\MySQL->from()` since for() it's deprecated.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/7
2025-11-01 16:37:26 +01:00
3cc4984b14 docs: replace docs links with comments (#5)
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/5
2025-11-01 16:27:01 +01:00
3357416ad0 fix: namespace and relative source import paths (#1)
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/1
2025-10-30 09:18:02 +01:00
e0cdfebc27
initial commit 2025-10-29 19:56:57 +01:00