Skip to content

Commit

Permalink
add default null to Instance entity nullables field
Browse files Browse the repository at this point in the history
add default values of null to DB nullable properties to prevent
access before initialization problems on php side

currently observed the error with the field
`Instance::$lastSuccessfulReceive` but added null default to all
nullable fields just in case

    "Handling "App\Message\ActivityPub\Inbox\ActivityMessage" failed:
    Typed property App\Entity\Instance::$lastSuccessfulReceive must not
    be accessed before initialization"
  • Loading branch information
asdfzdfj committed Aug 8, 2024
1 parent 710755d commit a68e8e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Entity/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ public static function getDateBeforeDead(): \DateTimeImmutable
}

#[Column(nullable: true)]
public ?string $software;
public ?string $software = null;

#[Column(nullable: true)]
public ?string $version;
public ?string $version = null;

#[Column(unique: true)]
public string $domain;

#[Column(type: 'datetimetz_immutable', nullable: true)]
private ?\DateTimeImmutable $lastSuccessfulDeliver;
private ?\DateTimeImmutable $lastSuccessfulDeliver = null;

#[Column(type: 'datetimetz_immutable', nullable: true)]
private ?\DateTimeImmutable $lastFailedDeliver;
private ?\DateTimeImmutable $lastFailedDeliver = null;

#[Column(type: 'datetimetz_immutable', nullable: true)]
private ?\DateTimeImmutable $lastSuccessfulReceive;
private ?\DateTimeImmutable $lastSuccessfulReceive = null;

#[Column]
private int $failedDelivers = 0;
Expand Down

0 comments on commit a68e8e6

Please sign in to comment.