X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseModel.php;h=41320d8bd5bcf528529b9a6f623babf9bfe84508;hb=c210e0b97f847501374a5d7609e13730e2c6c4dc;hp=b2dc7eedaf50ad58b88da114134f2d4671b79852;hpb=ae2959c7805ae458b125f33e34f650c1520b4ccf;p=friendica.git diff --git a/src/BaseModel.php b/src/BaseModel.php index b2dc7eedaf..41320d8bd5 100644 --- a/src/BaseModel.php +++ b/src/BaseModel.php @@ -1,4 +1,23 @@ . + * + */ namespace Friendica; @@ -12,7 +31,7 @@ use Psr\Log\LoggerInterface; * * @property int id */ -abstract class BaseModel +abstract class BaseModel extends BaseEntity { /** @var Database */ protected $dba; @@ -53,6 +72,11 @@ abstract class BaseModel return $this->originalData; } + public function resetOriginalData() + { + $this->originalData = $this->data; + } + /** * Performance-improved model creation in a loop * @@ -117,7 +141,7 @@ abstract class BaseModel 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'); } }