MODX Community

Basic CRUD help

I am quite new to Modx/programming, snippets & PHP in particular, and I am strugglingly hard atm understanding adding basic CRUD functions.

I am looking to learn by creating a simple new table in the modx mySQL, and the map for xPDO, so that I can use CRUD calls to populate my vue variables instead of my current workarounds of an outside mongo based api.

The documentation, is jumping all over the map. Creating new outside code repos and what not and going on all sorts of tangets.

I created a sandbox and installed vue. I can return any native modx element/array etc purely using snippets and java:

Can someone more experienced point me to the exact page/section in this documentation or better provide a streamlined example:

  1. For creating a new table inside the modx mySQL database
  2. access/modifying that table’s data
  3. where and how to right the model(etc) xml need to be to work with xPDO


Start with your xPDO model (#3), see this section: - note the different pages in that section in the navigation.

With your xPDO model, you can create the table through the xPDOManager, see xPDOManager->createObjectContainer.

After that you can refer to Creating Objects, Retrieving Objects and Removing Objects on interacting with those objects.

This tutorial is a little out of date, but I think you may find it useful.