Skip to content

class Athena::ORM::Bundle::Registry
inherits Reference #

Provides the AORM::EntityManager of the current unit of work, such as a request.

The entity manager is created the first time it's needed, on a connection checked out from the connection pool of the configured url. #close closes it and returns its connection to the pool, which the Athena Framework does once each request is done. #reset only clears it, which the framework does between the requests made within a test, see ADI::Spec::ContainerTestCase.

Included modules

Athena::Contracts::Service::Closeable Athena::Contracts::Service::Resettable

Constructors#

.new(url : String, event_dispatcher : ACTR::EventDispatcher::Interface | Nil = nil)#

View source

Methods#

#close : Nil#

Closes the entity manager, if one was created, rolling back any transaction left open and returning its connection to the pool.

View source

#manager : AORM::EntityManager#

Returns the entity manager of the current unit of work, creating it if needed.

View source

#reset : Nil#

Clears the entity manager, if one was created, keeping it open on its connection.

Transactions left open are left to whoever began them.

View source