fix: Preserve sub-namespace when generating Entity from Model (--return=entity)#10232
fix: Preserve sub-namespace when generating Entity from Model (--return=entity)#10232xgrind wants to merge 1 commit into
Conversation
|
Hi there, xgrind! 👋 Thank you for sending this PR! We expect the following in all Pull Requests (PRs).
Important We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works. If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md Sincerely, the mergeable bot 🤖 |
|
Please add a test showing the fix works. |
|
// before the fix CodeIgniter v4.7.3-dev Command Line Tool - Server Time: 2026-05-23 14:24:35 UTC+00:00 File created: APPPATH/Entities/Class.php File created: APPPATH/Models/Admin/Class.php // after the fix CodeIgniter v4.7.3-dev Command Line Tool - Server Time: 2026-05-23 14:27:11 UTC+00:00 File created: APPPATH/Entities/Admin/Class.php File created: APPPATH/Models/Admin/Class.php |
This change ensures that when a model is generated with
--return=entity,the Entity generator is invoked with the fully-qualified entity class name
so any sub-namespace in the model name (for example
Admin) is preservedin the Entity file and namespace.
How to reproduce (before fix)
php spark make:model Admin/Class --return entityHow to verify (after applying fix)
php spark make:model Admin/Class --return entity