[TYPO3-mvc] RFC #11230: Allow multiple repositories per model class and add unit tests for the persistence manager

Sebastian Kurfürst sebastian at typo3.org
Wed Jan 19 08:14:20 CET 2011


Hey Oliver,

sorry for not responding for so long.


> 1. Currently, it is not possible to have more than one repository class
> (e.g. a DB repository and a web service repository) for the same model
> class because PersistenceManager::persistAll checks for the existence of
> a name-based repository class.
If one wants to provide different data sources for objects, one needs to
provide a Persistence Backend which does the distinction based on the
data type. Using different repositories for the same model IMHO does not
make sense; as the repository only acts as a facade to the user, so he
can access the Aggegate Root objects. They should, however, not deal
with the backends.
You can see f.e. in
http://forge.typo3.org/projects/extension-nxsolrbackend/repository/revisions/42099/entry/trunk/Classes/Persistence/Storage/ProxyBackend.php
how the distinction is made in the objects.

> 1. When checking for aggregate root objects for the reconstituted models
> from the session, the persistence manager also needs to take the
> repositories into account which it already knows about.
If we change it this way, this first needs to go through the FLOW3
review process. However, I am not sure this makes sense, as it then
depends on *which repositories are loaded* and even worse, the loading
order of the repositories. Imagine two repositories declaring to be
responsible for the same object, and if both are loaded in the same
request, then it is completely undetermined which one is "responsible"
for it; i.e. from your code I have seen that the last one wins.

Sorry, from my side, I have to give a -1 to this patch because of the
reasons detailed above.

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list