What happened?
Description
I have an Entry::EVENT_BEFORE_SAVE event in which I do:
$entry->setFieldValues([
'latitude' => $coords['lat'],
'longitude' => $coords['lng'],
]);
This works when updating entries, but not for the case where $entry->firstSave is true.
Steps to reproduce
- Create an event listener that sets entry field values.
Expected behavior
It should work on first save.
Actual behavior
The first time saving it doesn't work, on updating it does.
Craft CMS version
5.2.6
PHP version
8.3
Operating system and version
No response
Database type and version
PostgreSQL 16
Image driver and version
No response
Installed plugins and versions
What happened?
Description
I have an Entry::EVENT_BEFORE_SAVE event in which I do:
This works when updating entries, but not for the case where
$entry->firstSaveistrue.Steps to reproduce
Expected behavior
It should work on first save.
Actual behavior
The first time saving it doesn't work, on updating it does.
Craft CMS version
5.2.6
PHP version
8.3
Operating system and version
No response
Database type and version
PostgreSQL 16
Image driver and version
No response
Installed plugins and versions