Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Fixture builder: accept a PageBuilder or PageDataBuilder as the target of linkRoute(), linkIri() and redirect(to:)

已关闭
#471 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #474 来自 @silverbackdan —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
15/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
php, symfony
领域
backend, testing

调研方向

Start with the open pull request #474 to see what it already covers before writing anything. The payload names linkRoute(), linkIri() and redirect(to:) on the fixture builder, PageBuilder and PageDataBuilder, and getRoute() for kept pages in --append loads. Done means CwaFixtureBuilderTest and CwaFixtureBuilderAppendTest pass with a builder target resolving to its generated route, including about-1, and a route-less builder throwing.

由索引模型根据 Issue 内容生成。

描述

Follow-up to #452. A hand-written scaffold has to refer to a route by name, in linkRoute(property, routeName:), linkIri(..., route:) and $cwa->redirect(path, to:). That means it has to know the name generated for a page, even when the page was declared a few lines earlier and the builder is in hand.

Proposal: let these calls take the PageBuilder or PageDataBuilder itself as well as a route name.

  • linkRoute('route', page: $about), with $about being a PageBuilder or PageDataBuilder.
  • $cwa->redirect('/old', to: $about).
  • It resolves to that builder's route once routes exist, which is the same moment linkRoute() resolves today, so it adds no flush.
  • A builder with no route (withoutRoute(), a template page, untitled) throws, naming the page and the caller.
  • A kept page in an --append load resolves to its existing route, as getRoute() already does.

The generator keeps writing route names, because it always knows them. This is a convenience for scaffolds written by hand.

Proposed tests:

  • CwaFixtureBuilderTest: a builder target resolves to the generated route, including a suffixed one (about-1), with no extra flush. A builder with no route throws.
  • CwaFixtureBuilderAppendTest: a kept page resolves to its existing route.
主要语言
PHP
星标
32
派生
8
平均合并
56 分钟
30 天内合并 PR
164

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

components-web-app/api-components-bundle 的其他 Issue

查看 components-web-app/api-components-bundle 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。