Skip to content

Commit

Permalink
remove typed entity class attrs to avoid dealing with default value i…
Browse files Browse the repository at this point in the history
…ssues

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Oct 9, 2024
1 parent 7b00ff2 commit d0a8f70
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 64 deletions.
30 changes: 15 additions & 15 deletions lib/Db/Bill.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@
* @method void setDeleted(int $deleted) */
class Bill extends Entity implements \JsonSerializable {

protected string $what = '...';
protected ?string $comment = null;
protected int $payerId = 0;
protected float $amount = -1;
protected int $timestamp = 0;
protected string $repeat = 'n';
protected int $repeatAllActive = 0;
protected ?string $repeatUntil = null;
protected int $repeatFrequency = 1;
protected string $projectId = '';
protected ?int $categoryId = null;
protected ?string $paymentMode = null;
protected ?int $paymentModeId = 0;
protected int $lastChanged = 0;
protected int $deleted = 0;
protected $what;
protected $comment;
protected $payerId;
protected $amount;
protected $timestamp;
protected $repeat;
protected $repeatAllActive;
protected $repeatUntil;
protected $repeatFrequency;
protected $projectId;
protected $categoryId;
protected $paymentMode;
protected $paymentModeId;
protected $lastChanged;
protected $deleted;

public function __construct() {
$this->addType('id', 'integer');
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/BillOwer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
**/
class BillOwer extends Entity implements \JsonSerializable {

protected int $billId = 0;
protected int $memberId = 0;
protected $billId;
protected $memberId;

public function __construct() {
$this->addType('id', 'integer');
Expand Down
11 changes: 6 additions & 5 deletions lib/Db/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
* @method int getOrder()
*/
class Category extends Entity implements \JsonSerializable {
protected string $projectId = '';
protected ?string $name = null;
protected ?string $color = null;
protected ?string $encodedIcon = null;
protected int $order = 0;

protected $projectId;
protected $name;
protected $color;
protected $encodedIcon;
protected $order;

public function __construct() {
$this->addType('project_id', 'string');
Expand Down
7 changes: 4 additions & 3 deletions lib/Db/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
* @method float getExchangeRate()
*/
class Currency extends Entity implements \JsonSerializable {
protected string $projectId = '';
protected string $name = '';
protected float $exchangeRate = -999;

protected $projectId;
protected $name;
protected $exchangeRate;

public function __construct() {
$this->addType('project_id', 'string');
Expand Down
17 changes: 9 additions & 8 deletions lib/Db/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@
* @method string getInviterDisplayName()
*/
class Invitation extends Entity implements \JsonSerializable {

public const STATE_PENDING = 0;
public const STATE_ACCEPTED = 1;

protected string $userId = '';
protected int $state = self::STATE_PENDING;
protected string $accessToken = '';
protected string $remoteProjectId = '';
protected string $remoteProjectName = '...';
protected string $remoteServerUrl = '';
protected string $inviterCloudId = '';
protected string $inviterDisplayName = '';
protected $userId;
protected $state;
protected $accessToken;
protected $remoteProjectId;
protected $remoteProjectName;
protected $remoteServerUrl;
protected $inviterCloudId;
protected $inviterDisplayName;

public function __construct() {
$this->addType('userId', 'string');
Expand Down
14 changes: 7 additions & 7 deletions lib/Db/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
*/
class Member extends Entity implements \JsonSerializable {

protected string $projectId = '';
protected string $name = '';
protected float $weight = -1;
protected int $activated = 1;
protected int $lastChanged = 0;
protected ?string $color = null;
protected ?string $userId = null;
protected $projectId;
protected $name;
protected $weight;
protected $activated;
protected $lastChanged;
protected $color;
protected $userId;

private $avatarManager;

Expand Down
13 changes: 7 additions & 6 deletions lib/Db/PaymentMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
* @method string|null getOldId()
*/
class PaymentMode extends Entity implements \JsonSerializable {
protected string $projectId = '';
protected ?string $name = null;
protected ?string $color = null;
protected ?string $encodedIcon = null;
protected int $order = 0;
protected ?string $oldId = null;

protected $projectId;
protected $name;
protected $color;
protected $encodedIcon;
protected $order;
protected $oldId;

public function __construct() {
$this->addType('project_id', 'string');
Expand Down
18 changes: 9 additions & 9 deletions lib/Db/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
*/
class Project extends Entity implements \JsonSerializable {

protected string $userId = '';
protected string $name = '';
protected string $autoExport = 'n';
protected int $lastChanged = 0;
protected int $deletionDisabled = 0;
protected string $categorySort = 'a';
protected string $paymentModeSort = 'a';
protected ?string $currencyName = null;
protected ?int $archivedTs = null;
protected $userId;
protected $name;
protected $autoExport;
protected $lastChanged;
protected $deletionDisabled;
protected $categorySort;
protected $paymentModeSort;
protected $currencyName;
protected $archivedTs;

public function __construct() {
$this->addType('id', 'string');
Expand Down
19 changes: 10 additions & 9 deletions lib/Db/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,22 @@
* @method int|null getState()
*/
class Share extends Entity implements \JsonSerializable {

public const TYPE_FEDERATION = 'f';
public const TYPE_PUBLIC_LINK = 'l';
public const TYPE_USER = 'u';
public const TYPE_GROUP = 'g';
public const TYPE_CIRCLE = 'c';

protected string $projectId = '';
protected ?string $userId = null;
protected string $type = self::TYPE_USER;
protected int $accessLevel = 2;
protected int $manuallyAdded = 1;
protected ?string $label = null;
protected ?string $password = null;
protected ?string $userCloudId = null;
protected ?int $state = null;
protected $projectId;
protected $userId;
protected $type;
protected $accessLevel;
protected $manuallyAdded;
protected $label;
protected $password;
protected $userCloudId;
protected $state;

public function __construct() {
$this->addType('project_id', 'string');
Expand Down

0 comments on commit d0a8f70

Please sign in to comment.