If a document is persisted without a locale, then the default locale should be used.
The document manager should always have a locale, if there is no locale the document manager is in an invalid state.
If find is called for an already loaded document and no locale is given, the currently registered locale for that document should be used, otherwise the default locale will be assumed.
Same behavior as (4) for persist.
find should NOT rehydrate the document unless the requested locale is different from the currently registered locale, or the rehydrate=false option is given (#78).
Subscribers should always assume that the locale is available, because (3) (#70).
it has been said that always having a locale is not necessary (e.g. for routes in Sulu)
Routes do not have localized properties. The locale therefore does not apply.
Overhead from processing localized listeners for non-localized documents: as there are no localized properties, such listeners will add little to no overhead.
Most property mapping should be happening the MappingSubscriber. In the future this can be optimized to do the minimum amount of work necessary, the MappingSubscriber should aggregate the responsiblity of mapping fields to properties and optimization should happen there - NOT in the subscribers.
State
Unlike even the Doctrine PHPCR-ODM, Sulu documents currently have more state than just locale, and the state depends on which options were given when calling find, for example load_ghost_content effects the state of the document.
Such state-altering options should combine with the locale to provide the state of the document, and the above numbered rules should also apply.
Locales
The system should work as follows:
find
is called for an already loaded document and no locale is given, the currently registered locale for that document should be used, otherwise the default locale will be assumed.persist
.find
should NOT rehydrate the document unless the requestedlocale
is different from the currently registered locale, or therehydrate=false
option is given (#78).it has been said that always having a locale is not necessary (e.g. for routes in Sulu)
State
Unlike even the Doctrine PHPCR-ODM, Sulu documents currently have more state than just
locale
, and the state depends on which options were given when callingfind
, for exampleload_ghost_content
effects the state of the document.Such state-altering options should combine with the
locale
to provide the state of the document, and the above numbered rules should also apply.