|A component for kernel||Grégory Salvan||12/22/11 8:46 AM|
I work on an open source project and wrote a small domain oriented
component to manage contexts.
I realized that this component can be included in symfony2 kernel and
may contribute to improve it.
So I pushed it on github and submit you the code, in hope it can help.
Git repository is here :
What is it ?
The base class manages :
- informations about context :
* the subject (what ?)
* the environment (where ?)
* the moment (when ? or while ...)
- descriptions that consists in contextual properties.
- context identity depending on properties
This class is extended with behaviours management.
Behaviours helps to define how to call a function or method and how to
create an object within context.
Finally, a small template class is provided to replace vars in
strings, objects properties or array elements by context properties
How integrate it in kernel ?
Kernel already uses contexts but in a different manner.
- the subject can be either :
* the name of kernel (property $name)
* the current application
- the environment is already used as is
- moment refers to mode debug (while debugging) and can be extended
to "when we are in production", "while testing"...
- Bundles can be descriptions of the context.
It can help to share kernel properties without directly use kernel
It separates responsibilities in a domain oriented manner.
Hope it helps.
As it's my first message here, I would thanks all for your great job,