xPDO.getObject
xPDO::getObject
Retrieves a single object instance by the specified criteria.
The criteria can be a primary key value, and array of primary key values (for multiple primary key objects) or an xPDOCriteria object. If no $criteria parameter is specified, no class is found, or an object cannot be located by the supplied criteria, null is returned.
Syntax
API Docs: http://api.modxcms.com/xpdo/xPDO.html#getObject
object|null getObject (string $className, [mixed $criteria = null], [mixed $cacheFlag = true])
Example
Get a Box object with ID 134.
$box = $xpdo->getObject('Box',134);
See Also
- Retrieving Objects
- xPDO.getCollection
- [xPDO.load]
- xPDO
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).