-
-
Notifications
You must be signed in to change notification settings - Fork 144
refactor(database): remove DatabaseModel interface
#1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DatabaseModel interface
|
The two failing tests are because of subcomponent changes |
Not sure I get this (maybe because I lack the context) - so whatever I say next can be completely wrong. But why don't you, instead, add a Like: final class Book
{
#[Key]
public string $uuid;
public string $title;
//...
}or #[PrimaryKey(['license_plate', 'state'])]
final class Car
{
public string $licensePlate;
public string $state;
public string $make;
//...
}of course, this would also work: #[PrimaryKey('uuid')]
final class Book
{
public string $uuid;
public string $title;
//...
}Taking inspiration from You could also add other attributes, like |
|
Yes, that's what we need to do. However, we first need to do some refactoring to make that work, because |
Closes #1074
TODOs:
DatabaseModelis goneIsDatabaseModeltrait is still available if people want some convenient shorthands likeModel::query(),$model->save(), etc. But it's totally optional.BindableModel::query()toModel::select()queryfunctionThe mapper currently assumes there's always an: Optional ids in ORM #1079Idfield on model classes. This assumption should be made optional, because IDs aren't actually required by the databaseQueryModel::delete,QueryModel::insertandQueryModel::createQueryModel, perhaps something likequery(Book::class)->…?SelectStatement(and also all upcoming statement classes)UpdateStatement,CreateStatement, andDeleteStatementDocument: non-model query supportDocument: non-model query support #1089Introduce model definition helper, something likeImprovemodel($objectOrClass)->hasPrimaryKey(),model($objectOrClass)->primaryKeyName()etc.ModelInspector#1086