Skip to content

Revise "Working with databases"#380

Merged
samdark merged 1 commit intomasterfrom
getting-started-revision
Feb 22, 2026
Merged

Revise "Working with databases"#380
samdark merged 1 commit intomasterfrom
getting-started-revision

Conversation

@samdark
Copy link
Member

@samdark samdark commented Feb 22, 2026

Q A
Is bugfix?
New feature?
Breaks BC?
Tests pass? ✔️
Fixed issues -

Copilot AI review requested due to automatic review settings February 22, 2026 14:46
@samdark samdark merged commit dbfe2c4 into master Feb 22, 2026
6 checks passed
@samdark samdark deleted the getting-started-revision branch February 22, 2026 14:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the “Working with databases” guide to treat slug as a persisted field on the Page entity instead of deriving it via getSlug(), and adjusts the accompanying repository/view/action examples accordingly.

Changes:

  • Add a slug property to the Page entity and generate it during Page::create() when not provided.
  • Update repository persistence and hydration to use $page->slug / $row['slug'].
  • Update view/action snippets to use the persisted slug instead of getSlug().

?DateTimeImmutable $createdAt = null,
?DateTimeImmutable $updatedAt = null,
): self {
string $slug = null,
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page::create() declares $slug as string but gives it a null default value. This is invalid in PHP and will fail static analysis / runtime type checks. Make the parameter nullable (?string $slug = null) or use a non-null default (and adjust the null-coalescing logic accordingly).

Suggested change
string $slug = null,
?string $slug = null,

Copilot uses AI. Check for mistakes.
use Yiisoft\Http\Status;
use Yiisoft\Router\HydratorAttribute\RouteArgument;
use Yiisoft\Router\UrlGeneratorInterface;
use Yiisoft\Strings\Inflector;
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EditAction snippet imports Yiisoft\Strings\Inflector but doesn’t use it. This makes the example inconsistent and may confuse readers; please remove the unused import or use it explicitly in the action.

Suggested change
use Yiisoft\Strings\Inflector;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants