Skip to content

annotation Athena::ORM::Annotations::PreFlush #

Marks a method to be called at the start of every AORM::EntityManager#flush, for each managed entity, before its changes are computed. Changes made by the callback are included in the flush.

@[AORMA::PreFlush]
def normalize_email(event : AORM::Events::PreFlushEventArgs) : Nil
  @email = @email.downcase
end

See AORMA::PrePersist for the rules every lifecycle callback follows. Unlike the other callbacks, the parameter is an AORM::Events::PreFlushEventArgs, which isn't generic.