|
EntityManager
The Entity ManagerThe EntityManager is the central access point for ORM functionality provided by Flextrine. It is used to manage the persistence of your object and to query for objects from the database. This class is a singleton which means that there is only ever one instance of the EntityManager in existence. To get a reference to this instance use the following code: var em:EntityManager = EntityManager.getInstance(); Configuring the Entity ManagerTo configure the EntityManager to point to your Flextrine server-side component set the configuration using the following code. Since EntityManager is a singleton you only need to do this once in your Flex application. var configuration:Configuration = new Configuration(); configuration.gateway = "http://localhost/myflextrineproject/gateway.php"; em.setConfiguration(configuration); Working with entitiesThe following methods are commonly used to manage your entities through the EntityManager. em.persist(entity:Object)The persist method marks the given entity for insertion into the database on the next flush. If an entity is removed with remove before the next flush occurs no action will be taken. em.remove(entity:Object)The remove method marks the given entity for deletion from the database on the next flush. em.flush()The flush method executes all queued operations against the server. This includes all persists, removes and any updates made to managed entities. |