Hi.
I've just commited my symfonized version of Garden to the mahono
branch.
This branch was copied from trunk and should work - if you want to
have a try. There are no BC issues.
Any feedback is appreciated!
So what is it all about? (If you know Garden: bean = tone in symfony)
First some short notes about the refactoring from Garden:
- I "converted" the xml format into yml which is definately easier to
write and makes it more "symfony like".
- I renamed "bean" into "tone" as I thought "symfony tone" is
cooler...
- Unless Garden I only use arrays for tone definitions (instead of
objects)
If you want to know more about the internals simply browse the
code. ;-)
sfContext has some new methods and I added sfToneConfigHandler as well
as sfToneFactory interface and sfToneFactoryAdapter.
At the end of this message I pasted a full description of a tone.yml
hoping that someone can understand it... ;-)
As you can see constructor injection is supported as well as setter
injection. And you can set these parameters in the tone.yml. Along
with some other settings like "singleton" or "lazy_init" this should
make core instances much more flexible to configure / replace /
overwrite ....
If you want to use the tones there are some new public methods in
sfContext:
$request = $context->getTone('Request');
This is just for example. Though I set up some tones they will
probably not work as expected yet.
But you can already try to configure some own tones. tone.yml files
can be put in app/config and in yourplugin/config
Regards,
Matthias
# default tone configuration
# Each "tone" element in this document defines a PHP tone (object).
# Typically the tone class and file is specified, along with PHP tone
# properties.
# Tone instances can be "singletons" (shared instances) or
"prototypes"
# (independent instances). Further scopes are supposed to be built on
top
# of the core tone factory infrastructure and are therefore not part
of it.
# References among tones are supported, i.e. setting a PHP tone
property
# or a constructor argument to refer to another tone in the same
factory
# (or an ancestor factory).
# As alternative to tone references, "inner tone definitions" can be
used.
# Inner tones are typically anonymous prototypes, therefore it is
recommended
# to set singleton property to false on such definitions.
# Tones are environment depended.
# Thus you can easily set different parameters in different
environments.
all:
description: # A optional description (string)
# alias for a tone which can reside in a different definition file
aliases:
# alias = alias of the tone
# name = name of the tone to define an alias for
alias: name
MyTone: # Identifier for use with sfContext-
>getTone($tone) and for references
# Identifiers must begin with an uppercased
character.
description: # (string) optional description of the tone
constructor_args: # constructor args passed to constructor or
factory in the same order you place them here
- [Tone, MyOtherTone] # This is how you can reference other
tones
- 356
- null
- true
properties: # Tone definitions can have zero or more
properties for setter injection.
setter1: [value1] # The tone factory will then call setter
methods, e.g. setSetter1() using call_user_func_array()
setter2: [35, 13]
# Each tone definition must specify the fully qualified name of
the class,
# except if it pure serves as parent for child tone definitions.
class: # (string) Full classname of the tone.
file: # (string) optional filename in which the class resides,
must be compatible for PHP's include but not needed with autoload
parent: # (string) Optionally specify a parent tone definition.
(constructor args and property values are inherited)
# Is this tone "abstract", i.e. not meant to be instantiated
itself but
# rather just serving as parent for concrete child tone
definitions.
# Default is false. Specify true to tell the tone factory to not
try to
# instantiate that particular tone in any case.
abstract: # (bool)
singleton: # (bool)
lazy_init: # (bool) whether the tone should get instantiated on
startup (false) or not (true)
# default is true
depends_on: # (string) The names of the tones that this tone
depends on being initialized.
init_method: # (string) Optional attribute for the name of the
custom initialization method
# to invoke after setting tone properties.
destroy_method: # (string) Optional attribute for the name of the
custom destroy method to invoke
# on tone factory shutdown. NOTE: Only invoked on
singleton tones! (??)
factory_method: # (strong) Optional attribute specifying the name
of a factory method to use to
# create this object.
factory_tone: # (string) Alternative to class attribute for
factory-method usage.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---