Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$125 per month—let's make that $500!Learn more
What is a Model?¶
Broadly speaking, the model layer in any MVC framework refers to data (often from the database) and the code that interacts with it. MODX uses xPDO as an object-relational map, which represents the database data in code form.
A model is simply a representation of a database in code form. xPDO uses XML schema files to define database tables as XML objects. This is a similar approach used by other MVC frameworks, e.g. Symphony, which uses YAML files to define models.
After a model has been defined in XML, the XML is parsed and builds out "maps" and class files. The maps are PHP arrays that are parsed at runtime to tell xPDO information about the tables. The classes are actual PHP classes by which each instance represents a row in the specified table.