Closed
Description
A concept well described in e.g. this thread:
http://www.theserverside.com/news/thread.tss?thread_id=26205
and also in #835
Basically, one could then be able override the getConnection
method of such a class:
class foo {
// ...
public/protected function getConnection()
{
return new FooDefaultConnection();
}
}
with a generated proxy ($this->container
auto-injected by some to-be-defined mean):
class extends foo {
private $container;
public/protected function getConnection()
{
return $this->container('connection_for_foo'):
}
}
in XML, this could defined with something like e.g.:
<service id="foo" class="foo">
<getter name="getConnection" type="service" id="connection_for_foo" />
</service>
so that $container->get('foo')
returns an instance of the generated class (and by this mean an instance of foo
of course).
The benefits?
- Lazyness made simple and almost free! I may give it a try;
- immutability (if no corresponding setter exists of course)
Metadata
Metadata
Assignees
Labels
RFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)