Gets an application domain specific model of choice, as implemented by a
subclass.
final public getEntity ( |
||
$identifier | ||
$create_fresh_entity | boolean | optional. if true, then a new instance is always created, else it might be cached if used for the same Identifier (performance). Since a statemachine might run multiple transitions in memory and alter the data in the persistence layer, there might be a need to refresh the entity (create it again) if the in memory object and the data in the persistence layer are not synchronized. this might cause rules or commands to act on in-memory data while it should use the persisted data. (an ORM should handle this automatically) |
return | Object | an object of any type, depending on the statemachine. This object will be used by the Rule and Command that go with a certain statemachine. It will be injected in the constructor of the Rule and Command. It implements caching so we always get the same entity instance on each call of 'getEntity' with the same Context |