Skip to content

docs: xPDO 3 Composer and model migration guide (#121) - #602

Open
Ibochkarev wants to merge 2 commits into
modxorg:3.xfrom
Ibochkarev:docs/issue-121-xpdo-3
Open

docs: xPDO 3 Composer and model migration guide (#121)#602
Ibochkarev wants to merge 2 commits into
modxorg:3.xfrom
Ibochkarev:docs/issue-121-xpdo-3

Conversation

@Ibochkarev

Copy link
Copy Markdown
Collaborator

Description

Adds a dedicated xPDO 3 upgrade guide (EN + RU) covering Composer delivery of xpdo/xpdo, PSR-4 / src/ model layout, metadata.mysql.php, namespaced addPackage, schema version="3.0", and a 2.x → 3.x Extra migration checklist with before/after examples.

Links the guide from the 3.0 upgrade index, breaking changes, class-names (xPDO aliases), the xPDO hub glossary, and the custom database tables tutorial. Closes the “xPDO 3 / PSR-4 Composer reference” and “2.x models → namespaced packages” gaps called out in #121.

Verified against Revolution 3.x (composer.json, modX / addPackage / setPackageMeta, core metadata.mysql.php, changelog #14534 / #13781).

Affected versions

3.x

Relevant issues

Refs #121

@Ibochkarev
Ibochkarev marked this pull request as ready for review August 15, 2026 17:39
@Ibochkarev
Ibochkarev requested a review from Mark-H August 15, 2026 17:39
Dedicated EN/RU upgrade reference for namespaced models, metadata maps,
and Extra addPackage calls, linked from the 3.0 upgrade hub.
@Ibochkarev
Ibochkarev force-pushed the docs/issue-121-xpdo-3 branch from 6df763c to ca44f72 Compare August 17, 2026 09:18
sortorder: 5
---

MODX 3 ships **xPDO 3** through Composer (`xpdo/xpdo` in `composer.json`). The library no longer lives as loose files under `core/xpdo/`. Model classes use PHP namespaces and PSR-4 autoloading. [#14534](https://github.com/modxcms/revolution/pull/14534), [#13781](https://github.com/modxcms/revolution/pull/13781)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a 100k line pr isn't useful to reference to anyone

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed those PR links — agreed they are useless as references.

- `src/Model/metadata.mysql.php` (`version` ≥ `3.0`, `namespace`, `namespacePrefix`, `class_map`)
- `src/Model/mysql/Task.php` (platform map)

Old 2.x layouts that only ship `model/mycomp/mysql/myobject.map.inc.php` without a 3.0 `metadata.mysql.php` will log a package metadata warning and will not register PSR-4 the same way.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong, 2.x also shipped metadata.mysql.php.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 2.x already had metadata.mysql.php; the 3.x change is regenerating it from a version="3.0" schema (namespace / class_map), not inventing the file.


## Composer and PSR-4

Install or update dependencies from the project root (or wherever your `composer.json` lives):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this suggests users need to manually composer install to get xPDO 3 or even that they need a composer.json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote that section. Normal upgrades already ship core/vendor/; no project composer.json or manual composer install is required for xPDO 3. Composer is called out only for Git/core rebuilds and Extras that manage their own deps.

Drop huge PR links, clarify that 2.x already had metadata.mysql.php,
and state that normal upgrades ship vendor/ without a manual composer
install.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants