refactor: drop compound databaseId:tableId resourceId#176
refactor: drop compound databaseId:tableId resourceId#176
Conversation
The CSV/JSON sources and destinations took a single composite
"databaseId:tableId" string and split it on ':' internally. The Appwrite
source did the same trick on `rootResourceId` to scope a transfer to a
specific collection within a database. That mixed two identifiers in
one slot, broke queryability for callers, and forced consumers to
recompose the colon-form at the boundary.
This change replaces the compound with explicit fields:
- CSV/JSON Source/Destination constructors now take `string $databaseId,
string $tableId` directly. No more `explode(':', $resourceId)`.
- Target/Source/Destination/Transfer::run gain a new optional
`$rootResourceChildId` parameter that, for database roots, scopes the
transfer to a specific table/collection inside the root database.
`$rootResourceId` keeps its existing semantics — it always matches
`$rootResourceType` (a top-level resource).
- Sources/Appwrite no longer inspects `rootResourceId` for ':' or
splits it; it reads `$this->rootResourceChildId` when the caller wants
per-collection filtering.
Tests updated to call the new constructor signatures.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR replaces the compound
Confidence Score: 3/5Not safe to merge until the abstract One P1 defect: the abstract method in src/Migration/Target.php — abstract Important Files Changed
Reviews (1): Last reviewed commit: "refactor: drop compound `databaseId:coll..." | Re-trigger Greptile |
| * @param string $rootResourceChildId Optional child filter under the root resource. For database roots, this is the collection/table ID. | ||
| */ | ||
| abstract public function run(array $resources, callable $callback, string $rootResourceId = ''): void; | ||
| abstract public function run(array $resources, callable $callback, string $rootResourceId = '', string $rootResourceChildId = ''): void; |
There was a problem hiding this comment.
Abstract
run signature is missing $rootResourceType
The abstract declares the 4th positional parameter as $rootResourceChildId, but both concrete overrides (Source::run and Destination::run) insert $rootResourceType as the 4th parameter and push $rootResourceChildId to 5th. Any caller typed as Target that passes 4 positional args will silently route their $rootResourceChildId value into $rootResourceType, leaving $rootResourceChildId as '' and making table-scoped transfers silently no-ops.
| abstract public function run(array $resources, callable $callback, string $rootResourceId = '', string $rootResourceChildId = ''): void; | |
| abstract public function run(array $resources, callable $callback, string $rootResourceId = '', string $rootResourceType = '', string $rootResourceChildId = ''): void; |
Summary
string \$databaseId, string \$tableIddirectly. The colon-splitting on\$resourceIdis gone.Target::run/Source::run/Destination::run/Transfer::rungain a new optional\$rootResourceChildIdparameter. For database roots, this scopes the transfer to a specific table within the root database.\$rootResourceIdkeeps its existing semantics (always matches\$rootResourceType).Test plan
composer lintpasses locallycomposer check(PHPStan level 3) passes locallyLinked
🤖 Generated with Claude Code