Using PHP, I want to update a field of Entries
type of an existing entry.
Fields of type Text
and Number
will update with the following code:
$entry = Entry::find()->id($entryId)->one();
$entry->textField = 20; // works
$entry->entriesField = Entry::find()->id($relatedEntryIds)->all(); // doesn't work
Craft::$app->elements->saveElement($entry);
I looked into the source code and it seems to be expecting a craft\elements\db\EntryQuery
object but I can't get it to work.
Can anyone please help?