Skip to content

T50 make model - #63

Merged
niden merged 5 commits into
masterfrom
T50-make-model
Oct 15, 2026
Merged

niden merged 5 commits into
masterfrom
T50-make-model

Conversation

@niden

@niden niden commented Oct 15, 2026

Copy link
Copy Markdown
Member

Hello!

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • composer test, composer cs and composer analyze all pass
  • I have created a PR for the documentation about this change, if user facing

  • Added make:model for MVC projects: it reads a table through the db service of the project (crest boots the front controller that bootstrap names), and writes a model in src/Models/ and its base in src/Models/Base/, which crest owns. The base has a typed nullable property for each column and initialize() with setSource(). A second run writes the base again from the table and keeps the model.
  • Added the model default path (src/Models) for MVC projects, and the MVC stubs model, model-base and fragment-model-property.
  • Added Crest\Generator\ClassName::fromTable() and RESERVED, Crest\Generator\ModelProperties and Crest\Project\Database. ClassName::PATTERN is public.
  • Changed init: for an MVC project, it also asks for the model folder, so a script that sends answers to init needs one more line.

Thanks

niden added 4 commits October 15, 2026 09:43
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
@niden
niden requested a review from Jeckerson October 15, 2026 14:48
@niden niden self-assigned this Oct 15, 2026
@niden niden added the enhancement New feature or request label Oct 15, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (9c86398) T50-make-model (16f2a6b) +/-
Coverage 99.6% 99.6% +0.0%
Test Execution Time 7s 6s -1s
Details
  |                     | master (9c86398) | T50-make-model (16f2a6b) |  +/-  |
  |---------------------|------------------|--------------------------|-------|
+ | Coverage            |            99.6% |                    99.6% | +0.0% |
  |   Files             |               72 |                       75 |    +3 |
  |   Lines             |             1920 |                     2042 |  +122 |
+ |   Covered           |             1913 |                     2035 |  +122 |
+ | Test Execution Time |               7s |                       6s |   -1s |

Code coverage of files in pull request scope (100.0% → 100.0%, patch 100.0%)

Files Coverage +/- Patch Coverage Status
src/Command/Make/ControllerCommand.php 100.0% 0.0% 100.0% modified
src/Command/Make/ModelCommand.php 100.0% +100.0% 100.0% added
src/Command/ProjectCommand.php 100.0% 0.0% 100.0% modified
src/Commands.php 100.0% 0.0% 100.0% modified
src/Generator/ClassName.php 100.0% 0.0% 100.0% modified
src/Generator/ModelProperties.php 100.0% +100.0% 100.0% added
src/Project/Config.php 100.0% 0.0% 100.0% modified
src/Project/Database.php 100.0% +100.0% 100.0% added

Reported by octocov

@niden
niden merged commit 73fc559 into master Oct 15, 2026
24 checks passed
@niden
niden deleted the T50-make-model branch October 15, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant