Skip to content

Commit

Permalink
Merge branch 'develop' into feat/forwards
Browse files Browse the repository at this point in the history
  • Loading branch information
64knl committed Nov 28, 2023
2 parents cd42612 + 5e6a9b2 commit fad4301
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
*/
public function up(): void
{
if (Schema::hasColumn('menu', 'created_at')) {
return;
}
Schema::table('menu', function (Blueprint $table) {
$table->timestamp('created_at');
$table->timestamp('created_at')->nullable();
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/FieldsProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function addLayoutFields(array $properties, LayoutForm &$form)
// $checkboxField->setValue(true);
// } else {
$checkboxField->setValue(false);
// }
// }
} else {
$checkboxField->setValue($value ?? false);
}
Expand Down
27 changes: 13 additions & 14 deletions src/Services/Indexer/SearchItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ final class SearchItem

private bool $inSitemap = true;

private ?DateTime $publicationDate;
private ?DateTime $publicationDate = null;

private ?DateTime $lastUpdated;
private ?DateTime $lastUpdated = null;

private int $priority = 1;

Expand Down Expand Up @@ -146,12 +146,7 @@ public function content(): ?string
*/
public function publicationDate(): ?string
{
$time = $this->publicationDate ?? $this->lastUpdated;
if ($time === null) {
return null;
}

return $time->format(DateTime::ATOM);
return $this->toDateString($this->publicationDate ?? $this->lastUpdated);
}

/**
Expand All @@ -162,12 +157,7 @@ public function publicationDate(): ?string
*/
public function lastUpdated(): ?string
{
$time = $this->lastUpdated ?? $this->publicationDate;
if ($time === null) {
return null;
}

return $time->format(DateTime::ATOM);
return $this->toDateString($this->lastUpdated ?? $this->publicationDate);
}

public function customValues(): ?array
Expand All @@ -189,4 +179,13 @@ public function sitemap(): bool
{
return $this->inSitemap;
}

private function toDateString(?DateTime $date): ?string
{
if ($date === null) {
return null;
}

return $date->format(DateTime::ATOM);
}
}

0 comments on commit fad4301

Please sign in to comment.