-
☆ A M B ☆
- 24,524 Posts
I'm sure BobRay will come up with the perfect snippet code for you.
I was working with databases in dBase and FoxPro, even taught a class on building your own database with QuickBasic, so I tend to think in terms of raw database access in the case of one-off applications like this.
I totally agree. It just makes sense.
The reason I put in the original criterion is so that the snippet wouldn't change the class_key fields of SymLinks, WebLinks, and Static Resources.
To do that and specify a parent, it would look like this:
$parent = 12; // Set to desired parent ID.
$docs = $modx->getCollection('modResource', array('class_key' => 'modDocument', 'parent' => $parent));
$newValue = 'Taxonomy';
foreach($docs as $doc) {
$doc->set('fieldName', $newValue);
$doc->save();
}