Entity Manager

To create an entity manager instance and use the methods bellow:

let manager = wetland.getManager();
`

.createScope()

Creates a new entity manager scope.

manager.createScope();

.getRepository()

Returns an entity repository instance for provided entity.

Note: If you're planning on doing work with the unit of work (wetland.getManager() / EntityManager.createScope()) you must use the scope to get the repository.

Repositories fetched from the entity manager are a more performant way of querying the database, but they're never linked to a scope. If all you're planning on doing is fetching data or performing simple queries, this method is for you.

The queries performed on a repository fetched from the EntityManager do run in an internal scope, so they're safe to use in for example APIs.

manager.getRepository(entity);

.getConfig()

Gets the config using .getConfig() from wetland.

manager.getConfig();

.getEntities()

Returns all registered entities as an object.

manager.getEntities();

.getEntity()

Get the reference to an entity constructor by its name.

manager.getEntity('entityName');

.getMapping()

Get the mapping for provided entity. Can be an instance, constructor or the name of the entity.

manager.getMapping(entity);

.registerEntities()

Register multiple entities.

manager.registerEntities([entity1, entity2]);

.registerEntity()

Register a single entity.

manager.registerEntity(entity);

.resolveEntityReference()

Resolve provided value to an entity reference. The argument can be a name, the constructor or the entity itself.

manager.resolveEntityReference(entity);

results matching ""

    No results matching ""