Skip to content

T84 adr repositories - #92

Merged
niden merged 3 commits into
masterfrom
T84-adr-repositories
Nov 22, 2026
Merged

niden merged 3 commits into
masterfrom
T84-adr-repositories

Conversation

@niden

@niden niden commented Nov 22, 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:repository <table> for ADR projects, over the data mapper (Phalcon\DataMapper), as in vokuro-adr. It writes src/Repository/Base/<Class>RepositoryBase.php, which crest writes again when the table changes (the table, its primary key, its columns, and find(), add(), update() and delete(); rows are arrays), and src/Repository/<Class>Repository.php, which the developer owns. The table needs a primary key with one column.

crest new --flavor=adr --database now registers a Phalcon\DataMapper\Pdo\Connection with the alias db, not a Phalcon\Db adapter. ADR projects get the default path repository, and init asks for it.

crest reads the columns and the primary key with one query for each driver (Crest\Generator\TableColumns), because a DataMapper connection does not describe a table. The base writes a null value with set(): columns() of DataMapper binds no value for null, and MySQL and PostgreSQL stop on that. The database suites run the generated repository on SQLite, MySQL, MariaDB and PostgreSQL.

Stacked on #91.

Thanks

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (1e0f636) #92 (67d4391) +/-
Coverage 99.8% 99.8% +0.0%
Test Execution Time 12s 7s -5s
Details
  |                     | master (1e0f636) | #92 (67d4391) |  +/-  |
  |---------------------|------------------|---------------|-------|
+ | Coverage            |            99.8% |         99.8% | +0.0% |
  |   Files             |               93 |            95 |    +2 |
  |   Lines             |             3729 |          3854 |  +125 |
+ |   Covered           |             3722 |          3847 |  +125 |
+ | Test Execution Time |              12s |            7s |   -5s |

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

Files Coverage +/- Patch Coverage Status
src/Command/Make/RepositoryCommand.php 100.0% +100.0% 100.0% added
src/Command/NewCommand.php 100.0% 0.0% 100.0% modified
src/Commands.php 100.0% 0.0% 100.0% modified
src/Generator/Project/DatabaseChoice.php 100.0% 0.0% 100.0% modified
src/Generator/TableColumns.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% 0.0% 100.0% modified

Reported by octocov

@niden niden self-assigned this Nov 22, 2026
@niden niden added the enhancement New feature or request label Nov 22, 2026
@niden niden mentioned this pull request Nov 22, 2026
3 of 4 tasks
Base automatically changed from T88-views-sequences-partitions to master November 22, 2026 02:09
@niden
niden merged commit 8d022e2 into master Nov 22, 2026
40 checks passed
@niden
niden deleted the T84-adr-repositories branch November 22, 2026 02:10
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