Jump to main content Jump to doc navigation


Creates the container for a persistent data object. In this implementation, a source container is a synonym for a MySQL database table. The table name will be generated by the schema; related tables will not be created, however.


API Docs: createObjectContainer

void createObjectContainer (string $className)


Create the table for the class 'Person':

$manager = $xpdo->getManager();

If you need to do this in a MODX Snippet, you'd use the $modx object, and you'd have to make sure you added your package (and its model classes) first:

$manager = $modx->getManager();

Note that the database prefix here is independent of the MODX prefix. You may have modx_ for your MODX prefix and mypkg_ for your package's tables.

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.


  • modmore
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Digital Penguin
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Following Sea
  • Anton Tarasov
  • eydolan
  • Raffy
  • Lefthandmedia
  • Murray Wood
  • Nick Clark
  • Snow Creative
  • Helen
  • JT Skaggs
  • krisznet
  • YJ
  • Yanni
  • Richard


$371 per month—let's make that $500!

Learn more