From bb99b0bebe84c453785d7ef57102547dea81a4f0 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 5 Nov 2020 10:03:40 -0500 Subject: [PATCH] Allow models extending BaseModel to have an id equal to 0 --- src/BaseModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaseModel.php b/src/BaseModel.php index 8f9370bb09..41320d8bd5 100644 --- a/src/BaseModel.php +++ b/src/BaseModel.php @@ -141,7 +141,7 @@ abstract class BaseModel extends BaseEntity protected function checkValid() { - if (empty($this->data['id'])) { + if (!isset($this->data['id']) || is_null($this->data['id'])) { throw new HTTPException\InternalServerErrorException(static::class . ' record uninitialized'); } }