Conversation
samdark
commented
Feb 22, 2026
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
| Tests pass? | ✔️ |
| Fixed issues | - |
There was a problem hiding this comment.
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
slugproperty to thePageentity and generate it duringPage::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, |
There was a problem hiding this comment.
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).
| string $slug = null, | |
| ?string $slug = null, |
| use Yiisoft\Http\Status; | ||
| use Yiisoft\Router\HydratorAttribute\RouteArgument; | ||
| use Yiisoft\Router\UrlGeneratorInterface; | ||
| use Yiisoft\Strings\Inflector; |
There was a problem hiding this comment.
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.
| use Yiisoft\Strings\Inflector; |