Commit graph

14 commits

Author SHA1 Message Date
a19aceca7a
fix: allow mixed type for abstract $id property in Database\Model 2026-02-12 15:21:35 +01:00
c858cd111a fix: use array_key_exists() on $_ENV to determine if MariaDB key is set (#26)
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/26
2026-02-12 08:56:31 +01:00
8a04cab4b5 fix: database as optional parameter for set_credentials (#25)
This is another follow-up PR for #22 which fixes a deprecation issue about defining optional parameters that are then called as named.

```php
Database::set_credentials("db");
```
```
vlw\Scaffold\Database::set_credentials(): Optional parameter $host declared before required parameter $database is implicitly treated as a required parameter
```

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/25
2026-02-12 08:48:37 +01:00
f4b8f8673e fix: set Database env credentials without returning a new instance (#24)
This is a follow-up PR from #22. Instead of returning a new instance after setting the environment variables we simply do nothing. Most of the extending classes will not take advantage of the new instance anyways, and will just call `new Database()` as before. Of course, as mentioned in #22 this setup is not ideal, and another solution should be implemented to instance this class.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/24
2026-02-11 17:39:01 +01:00
1536079fe3 feat: add static method to create new Database instance from credentials (#22)
In this PR we add a new static method for creating a `vlw\Scaffold\Database\Database` instance from a set of provided credentials. This is of course not ideal and a better way to instance this class should be added in the future.

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/22
2026-02-11 17:25:22 +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
d9fca6d4e1 fix(style): trim trailing whitespaces (#12)
Remove all trailing whitespaces from source files. Looks like it was only docblocks tho, that's nice!

Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/12
2025-11-30 13:48:56 +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