In a Symfony 2 application I need a model class (without persistence in database) with a business logic features that involves to other entities (with persistence).
In my conceptual model there are "Rooms", "Connections" and "Algorithms". The Rooms and the Connections are Symfony entities based on doctrine. The Algorithms should be model classes or entities without persistence in database.
The business logic is the follow: - There are different kinds of Algorithms - One Algorithm makes relations between Rooms and Connections in function different criterias. This implies to retrieve Rooms or Connections from database, apply the logic, modify or create new entities to database.
The first approach I've made is an Algorithm Factory as a Symfony Service to provide a object to create an Algorithm base on a type parameter.
The controller invokes this service and call the algorithm's function to apply the logic.
The conceptual problem I've is the following: I don't know which type of Symfony element should be the Algorithm class. If it's an Entity it can't get Rooms or Connections from database with Doctrine Manager, isn't it? Should be it a Controller as a Service in terms of Symfony?
I've my doubts in how to represent this in Symfony architecture.
Thank you