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
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
a77c0ac6a3/composer.json (L15)
Follow-up PR from #18. Apparently we can't put things in the root namespace because of this. Maybe we can investigate this more but for now we have to keep the main Scaffold class under the original namespace `vlw\Scaffold\Scaffold`
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/20
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
This PR adds a `UUID::v7()` method for generating version 7 UUIDs, which have several performace advantages over v4 when stored in database indecies.
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/17
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 class for holding license constants, which is read by extensions like LibreJS to check that the site contains free JavaScript code.
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/15
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
Let's expose the uuid helpers as a class of static methods instead. I'm not sure if this approach is actually better but we're going to live with it for a while. I have done UUID helpers before this library as a class. So let's run with it again.
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/10
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
Restores the class method approach for loading source files from #2, which undoes the changes introduced in #3. I can't figure out a way to make the function load before initialization of downstream classes.
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/4
I know we just merged #2 and released verison 1.1.0 where the Vegvisir/Reflect crosstalk was supposed to be a class. But after using this briefly, I feel like it gets too verbose. This function will be called _a lot_ and therefore I think it should be pretty quick to type - just like the Vegvisir `VV` class.
Instead of typing
```php
use vlw\Scaffold\Scaffold;
Scaffold::include("some/file.php");
```
we can instead type
```php
use function vlw\Scaffold\load;
load("some/file.php");
```
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/3
In this PR we move the Vegvisir `VV` class import into Reflect from the API class into its own `Scaffold` class. This new class will include everything that is required for crosstalk between Vegvisir and Reflect.
Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/2