modResource.save
Last updated not available | Page history | Improve this page | Report an issue
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.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodResource.save¶
Writes the Resource to the database. A new record gets createdon and createdby from the current time and the logged-in user when they are still empty.
With friendly_urls on, the uri is recalculated when it is empty or when a field affecting it changed: alias, alias_visible, parent, context_key, content_type, isfolder, uri_override. A successful save then refreshes child URIs recursively; a changed context_key is propagated to all children. Set refreshURIs to true before calling the method to force that refresh.
The method fires no events itself. The save access policy check happens in modAccessibleObject::save(); the manager processors invoke OnBeforeDocFormSave and OnDocFormSave around their own calls.
Syntax¶
boolean save ([boolean $cacheFlag = null])
-
$cacheFlag(boolean) passed to the parent implementation to control caching of the saved object, by defaultnull
Example¶
$resource = $modx->getObject('modResource', array('id' => 5));
$resource->set('pagetitle', 'foobar');
$resource->save();
See Also¶
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.
Backers
Budget
$194 per month—let's make that $500!
Learn more










