magento / magento/community-features

SitemapItem implements dto pattern inconsistent with the rest of the framework.

Open
#91 3 comments 0 reactions 0 assignees View on GitHub
Priority: P4
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

### Summary

In Magento 2.3 Sitemap has been split into Sitemap and SitemapItem, so we can use ItemProviders to compose sitemaps. The way SitemapItem has been implemented is kind of weird though, it is a pure DTO. Yet is doesn't extend DataObject or any of it's child classes, all data is passed through the constructor and saved in class properties.

The issue with this is that ItemProviders now simply use new SitemapItem() calls meaning it is very hard to extend SitemapItems with more data in a clean way.

### Proposed solution

Make SitemapItem extend DataObject (or any of it's children), replace class properties with $data and interface all constants used.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate SitemapItem and the ItemProviders that instantiate it, then compare their DTO handling with the framework's DataObject patterns. Confirm whether extending DataObject or one of its children best supports additional provider data, and verify that the existing SitemapItem data and constants remain usable through the revised interface.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.