-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Open
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care ofenhancementintegration
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
Entities for db table abstraction represent one row of a database table. However, they do not reflect that some properties are never null. You can create an instance of an entity class without specifying any value. Not even the primary key is enforced.
$account = new Account();
$account->getId(); // NULLDescribe the solution you'd like
Allow entities to have a constructor with arguments that map directly to object properties.
class Account extends Entity {
/** @var string */
protected $userId;
public function __construct(int $id, string $userId) {
$this->id = $id;
$this->userId = $userId;
}
}
$account = new Account(123, 'admin');
$account->getId(); // Impossible to get NULL hereDescribe alternatives you've considered
n/a
Additional context
n/a
@miaulalala as discussed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care ofenhancementintegration