Creating Objects
Creating objects in xPDO utilizes the newObject xPDO method.
Let's say we have an object defined in our model of class "Box". We want to create a new object of it:
$myBox = $xpdo->newObject('Box');
It's that simple. We can also create the Box object with some pre-filled field values:
$myBox = $xpdo->newObject('Box',array( 'width' => 5, 'height' => 12, 'color' => 'red', ));
This will give us an xPDOObject-based Box object that can be manipulated and saved.
If your SQL table does not exist for the object you've created, and the object class has a defined table for that class, xPDO will automatically create the table in the database for you.
See Also
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).