Make ObjectManager optional for Kernel::System modules #1112
bschmalhofer
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I see some use cases of using
$Kernel::OM
for object creation:$Kernel::OM
is destroyed after each requestGet()
Create()
when theObjectParam
parameter is not definedBut for some modules, e.g.
Kernel::System::DateTime
these features are not useful, they produce only mental overhead. So we might want to ponder whether code likemy $Now = Kernel::System::DateTime->new
should be allowed. There is no technical difficulty here as the ObjectManager does the same thing when creating on object.Currently we have the following declarations:
new()
$Kernel::OM->Get()
$Kernel::OM->Create()
$Kernel::OM->Get()
or$Kernel::OM->Create()
Kernel::System::DateTime
is declared as NonSingleton.Technically we could create objects with
ǹew()
in any of these four cases. But this is definitly wrong in case 2. and maybe confusing in the cases 3. and 4. .Thus the question is only about the interface. The difficulty is that there is no obvious way how to check for the NonSingleton flag in themy $Now = Kernel::System::DateTime->new
case.A hack might be to provide derived classes that have a declaration of ObjectManagerDisabled. Or invent a completely new namespace for classes that have real object orientation.
Beta Was this translation helpful? Give feedback.
All reactions