Repository navigation
Conversation
Closes #245 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Active issues cause incorrect discovery and skipped counts for theme-owned files without --force, and TypeErrors for numeric extensionless filenames at both resolver calls.
2 open issues
What changed in this PR
Extends mageforge:template:override to copy directories recursively into a theme, addressing #245 while using the existing Magento fallback and Hyvä compatibility handling.
Changes:
- Adds directory references and parsing for module and theme view paths.
- Merges files across fallback locations and adds bulk copying with skip, force, dry-run, verification and cache-cleaning behaviour.
- Updates command documentation and unit tests.
| File | Description |
|---|---|
| tests/Unit/Service/TemplateOverride/TemplatePathParserTest.php | Tests directory parsing and invalid paths. |
| tests/Unit/Service/TemplateOverride/TemplateFallbackResolverTest.php | Tests recursive merging and fallback precedence. |
| tests/Unit/Console/Command/Template/OverrideCommandTest.php | Tests directory copying, skipping and dry runs. |
| src/Service/TemplateOverride/TemplatePathParser.php | Parses module and theme directories, including compat mappings. |
| src/Service/TemplateOverride/TemplateFallbackResolver.php | Collects files recursively across fallback directories. |
| src/Model/TemplateReference.php | Adds a directory flag to template references. |
| src/Console/Command/Template/OverrideCommand.php | Implements the directory override flow and usage help. |
| docs/commands_reference.md | Documents directory inputs and replacement behaviour. |
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ric file names Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Non-forced directory overrides incorrectly fail when templates exist only in the target theme because discovery excludes that directory instead of successfully skipping existing overrides.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because the new directory-mode tests do not exercise --force, leaving overwrite source selection, theme-only file preservation, and cache cleaning unverified on that path.
No open issues 🎉
Review effort: Balanced
| foreach ($sources as $relativePath => $sourceFile) { | ||
| // Numeric file names become integer array keys | ||
| $relativePath = (string) $relativePath; | ||
| if (isset($overridden[$relativePath]) && !$isForce) { |
…asts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Summary
mageforge:template:overridenow accepts a directory path and copies all files inside it (including subdirectories) into the theme.Closes #245
Behaviour
view/<area>/templates|email|web|layout(or a subdirectory), a Hyvä compat module or another theme's override directory are supported.--forcereplaces them with the next file in the chain.--dry-runlists source → target for every file without copying.Changes
TemplateReference: newisDirectoryflagTemplatePathParser: accepts directoriesTemplateFallbackResolver::findDirectoryFiles(): merges files across fallback directoriesOverrideCommand: directory flowTesting
phpunit tests/Unit: 751 tests passddev magento m:t:o <dir> -t <theme>)