Rekord „z widoku” w czterech słownikach: odwrotne flagi `is_custom`/`is_locked`, 10 traitów i zdublowane kontrakty
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with the cited models/Template.php, models/Layout.php, classes/SyncTemplates.php, and the traits under traits/; compare the duplicated fetch and synchronization paths, then trace the trait contracts and the two column definitions in models/template/columns.yaml and models/layout/columns.yaml. Use the acceptance criteria to define done: one implementation for fetch, refresh, and create; no duplicate abstract-method declarations or internally used-only traits; matching view-status UI; PHPStan level 7 and tests passing without assertion changes.
Written by the indexing model from the issue text.
Description
Problem
- Odwrotna polaryzacja flag. Szablon zapisuje odłączenie od widoku jako
is_custom = true, layout jakois_locked = false. Od #261 oba śledzą widok tak samo, ale wspólna logika wymaga par metod z odwróconym warunkiem:isCustomised(),markAsFollowingView(),prepareDuplicate(),formBeforeSave(). Pary już się rozjechały:Template::isCustomised()nie ma strażnika jakLayout(zob. #268). - Duplikacja po #261.
Layout::afterFetch()≈Template::afterFetch(),SyncTemplates::refreshLayouts()≈refreshTemplates(),createLayouts()≈createTemplates(). - Nazwy.
followsView()zwracatruetakże dla szablonu odłączonego, czyli znaczy „ma zarejestrowany widok”. TymczasemmarkAsFollowingView()i komunikatview_followsużywają „follows” w znaczeniu „nieodłączony”.Layout::followsViewUpdates()to z kolei globalna flaga migracji. - UI. Lista szablonów ma kolumnę Customized (włączone = odłączony), a sąsiednia zakładka layoutów From view (włączone = śledzi). To ta sama informacja z odwrotnym znaczeniem przełącznika.
- 10 traitów (backupmanager i maillog mają 1, seomanager i formbuilder 2, reszta 0).
- Sześć traitów modeli zawsze występuje razem w obu modelach.
- Ten sam kontrakt jest zadeklarowany kilka razy:
getView()wTranslatesContentiDescribesViewStatus,fillFromView()wTranslatesContentiFollowsView,isCustomised()wTranslatesContentiDescribesViewStatus. FollowsView::resetToView()wołainDefaultLocale()zTranslatesContent, nie deklarując tej zależności.ChecksFormPermissionsiRendersPreviewErrors(po jednej metodzie) są używane wyłącznie wewnątrzManagesViewRecords.PDFManagerma 9 metod publicznych: rejestr oraz niezwiązane z nimfindLocalizedView().
Dowód
models/Template.php:107-135, 251-254,models/Layout.php:86-89, 159-201,controllers/Templates.php:72-83,controllers/Layouts.php:36-41.classes/SyncTemplates.php:55-91vs:115-152.diffparafterFetch()daje 2 różnice (warunek flagi iunsetRelation('layout')).traits/FollowsView.php:43, 63-71,traits/TranslatesContent.php:12-16,traits/DescribesViewStatus.php:7-11,traits/ManagesViewRecords.php:24-25,classes/PDFManager.php:107-133.models/template/columns.yaml:21-23,models/layout/columns.yaml:11-13.- Liczba plików w
plugins/renatio/*/traits.
Skutek
Każda zmiana logiki śledzenia widoku wymaga dwóch edycji z odwróconym warunkiem, a rozjazd już dał błąd. Kontrakt jest rozproszony po trzech plikach, a zależności między traitami wychodzą dopiero w runtime. Użytkownik widzi tę samą informację z odwrotnym znaczeniem w dwóch zakładkach.
Proponowane rozwiązanie
- Jedno API w
FollowsView, neutralne co do polaryzacji (isCustomised(),markAsCustomised()/markAsFollowingView(), scopefollowingView()). Na nim jedna implementacjaafterFetch()i jedna pararefresh()/create()wSyncTemplates. followsView()zmienić na np.hasView(). Metoda jest nowa w 8.1.0 i nieopisana w README, więc zmiana nic nie łamie.- Ok. 4 traity zamiast 10:
- widok + opis statusu + zlokalizowany widok;
- walidacja (kod + Twig);
Duplicates;ManagesViewRecordsz wchłoniętymi jednometodowymi traitami.
PDFManagerzostaje samym rejestrem.- Opcjonalnie ta sama kolumna na obu listach (np. From view także dla szablonów) albo migracja odwracająca
is_locked.
Kryteria akceptacji
-
afterFetch(), odświeżanie i tworzenie w synchronizacji mają po jednej implementacji. - Żadna metoda abstrakcyjna nie jest deklarowana w więcej niż jednym traicie, żaden trait nie jest używany wyłącznie wewnątrz innego.
- Obie listy pokazują status widoku w ten sam sposób.
- PHPStan level 7 bez nowych wyciszeń, testy bez zmian asercji.
Powiązane issues
#214/#258 (duplikacja modeli i kontrolerów przed #261), #216 (zasada klas usługowych), #261 (źródło nowej duplikacji).
- Dominant language
- PHP
- Stars
- 30
- Forks
- 22
- Avg merge
- 2h 23m
- Merged PRs (30d)
- 77
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mplodowski/dynamicpdf-plugin
-
code-review documentation low-priority
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
mplodowski/dynamicpdf-plugin#295 · 1 comment ·
Maintainers usually reply within 1 day
-
code-review enhancement low-priority
Difficulty 5/5 Over a week Newbie friendliness 30/100
mplodowski/dynamicpdf-plugin#301 · 1 comment ·
Maintainers usually reply within 1 day
-
code-review enhancement low-priority
Difficulty 5/5 Over a week Newbie friendliness 25/100
mplodowski/dynamicpdf-plugin#300 · 1 comment ·
Maintainers usually reply within 1 day
-
code-review enhancement low-priority
Difficulty 5/5 Over a week Newbie friendliness 38/100
mplodowski/dynamicpdf-plugin#299 · 1 comment ·
Maintainers usually reply within 1 day
-
code-review enhancement low-priority
Difficulty 5/5 Over a week Newbie friendliness 35/100
mplodowski/dynamicpdf-plugin#298 · 1 comment ·
Maintainers usually reply within 1 day
All issues in mplodowski/dynamicpdf-plugin
Similar issues
-
bug code quality
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SemanticMediaWiki/SemanticMediaWiki#7149 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
google/site-kit-wp#13825 ·
Maintainers usually reply within 3 days
-
Made by AI module: MCP type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100