Page::save() Hook Execution and Atomic Persistence Limits
0 reputation · 03 Jun 2023, 21:56 UTC
In ProcessWire 3.x, the Page::save() method is used to persist page fields and metadata to the database. This process is designed to be atomic, returning the saved object or false upon failure, and triggers the saved hook after the database transaction is complete.
When designing integration tests using a local test database to avoid production credentials, it is necessary to understand the relationship between the persistence layer and hook invocation. Specifically, there is a need to determine if the saved hook execution is tied to the success of the atomic transaction or if it can be triggered independently during specific failure states.
- Does the
savedhook fire if the database transaction fails during thePage::save()process? - Are there specific
$optionsparameters that can suppress hook execution while still persisting data to the database?