Set multiple values in an Entry

In the documentation we see a way to set data via:

$entry->set('foo', 'bar');

However is there a way to set multiple items at once? I know we can use a loop here but would like to know if there's a better way.

Something like:

$entry->set('data', ['field1' => 'value1', 'field2' => 'value2'])

Just like what the make method does:

$entry = Entry::make() ->published() ->data(['title' => 'About us', 'subtitle' => 'We are awesome']) $entry->save();

Answered by Joms!
>>>>>>> Answered <<<<<<<
2 Replies
2 Followers