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
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
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
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
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
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
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