public function afterSave() {
// update properties of all child resources (merge with existing properties)
$parentProperties = $this->object->getProperties('goodnews');
foreach ($this->object->getIterator('Children') as $child) {
$child->setProperties($parentProperties, 'goodnews');
if (!$child->save()) {
$this->modx->log(modX::LOG_LEVEL_ERROR, "Could not change properties of child resource {$child->get('id')}", '', __METHOD__, __FILE__, __LINE__);
}
}
//todo: clear cache?
return parent::afterSave();
}
This question has been answered by markh. See the first response.
I personally wouldn't store container properties in the child resources at all.
But to answer your question, you could override the save method on the actual modResource extended class and handle stuff from there. Or in your update processor.
