modResource.setProperties
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.setProperties¶
Writes a whole namespace of properties in one call. With $merge set, $newProperties is merged over the values already in the namespace. Keys you leave out keep their previous values; with $merge false the namespace is replaced entirely. Other namespaces are never touched.
Returns the result of the field assignment; nothing reaches the database until save().
Syntax¶
boolean setProperties (array $newProperties [, string $namespace = 'core' [, boolean $merge = true]])
-
$newProperties(array) properties to write -
$namespace(string) namespace to write into, by default'core' -
$merge(boolean) merge with the existing namespace instead of replacing it, by defaulttrue
Example¶
$resource = $modx->getObject('modResource', array('id' => 5));
$resource->setProperties(array('color' => 'foobar', 'size' => '10'), 'mycomponent');
$resource->setProperties(array('color' => 'bar'), 'mycomponent', false);
$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










