X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseModel.php;h=8f9370bb09aa4f2b1574e49ec2c02918b4959fa1;hb=6749b2c887552feef3a671c4063425b11a92014a;hp=decc627521e50309a69dfe9195a1705ceab92b7d;hpb=4a3544582c570d43f7d274ddbae7ea835176cbd9;p=friendica.git diff --git a/src/BaseModel.php b/src/BaseModel.php index decc627521..8f9370bb09 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; @@ -48,23 +67,9 @@ abstract class BaseModel $this->originalData = $data; } - /** - * Maps a data array (original/current) to a known field list of the chosen model - * - * This is useful to filter out additional attributes, which aren't part of the db-table (like readonly cached fields) - * - * @param array $data The data array to map to db-fields - * - * @return array the mapped data array - */ - protected function mapFields(array $data) - { - return $data; - } - public function getOriginalData() { - return $this->mapFields($this->originalData); + return $this->originalData; } public function resetOriginalData() @@ -129,16 +134,9 @@ abstract class BaseModel $this->data[$name] = $value; } - /** - * Returns the values of the current model as an array - * - * @param bool $dbOnly True, if just the db-relevant fields should be returned - * - * @return array The values of the current model - */ - public function toArray(bool $dbOnly = false) + public function toArray() { - return $dbOnly ? $this->mapFields($this->data) : $this->data; + return $this->data; } protected function checkValid()