I'm working on a Craft project that has 3 sites. The content for one section is pulled from an API using a console script which runs every 5 minutes.
This has been working fine but I've discovered a bug that the title's aren't being updated across all sites as they are translatable.
This is my current code.
$entry->title = $data->name;
$entry->setFieldValues([
'body' => $data->text,
'relatedArticles' => array_map(function($id){
return [
'relatedId' => $id,
];
}, $data->related),
'categories' => array_map(function($cat) {
return (isset($this->categories[$cat])) ? (int) $this->categories[$cat] : false;
}, $data->categories),
]);
$success = Craft::$app->elements->saveElement($entry);
All other fields are not translatable so they work fine, Is there a way to propagate the title across all sites or do I need to loop through all the sites to update the entry?