Closed pawelbaranski closed 6 years ago
Hey! Thanks for the PR. I'm thinking in some problems related to this approach:
container.alias("some_alias", "some_alias");
? Infinite loop? container.set("session.mysql", function(c) {
// ....
});
container.alias("session", "session.mysql");
container.set("session", function() {
// ....
});
A exception is emitted on the set of the session, after adding the alias, because well, the key already exists. Should we ignore alias in that case or not?
container.alias("alias_1", "alias_2");
container.alias("alias_2", "alias_1");
Infinite loop, again?
container.alias("session", "session.mysql")
var session = container.raw("session");
I think that session
will not contain the original session.mysql
function, right?
user_repository.file
and user_repository.mysql
will have different options (probably using parameters like user_repository.file.path
for the first and user_repository.mysql.host
, user_repository.mysql.user
, user_repository.mysql.password
and user_repository.mysql.database
for the second), so to me makes sense to enable the developer to customize that in a better way, allowing it to directly use a parameter like user_repository.type
and a service like so:container.set("user_repository", function(c) {
return c.get("user_repository."+c.get("user_repository.type"));
});
Or similar, not? Note that is for a similar reason that this exactly feature was not added to the original Pimple (see silexphp/Pimple#115): seems to be too simple to the developer to enable a behavior similar to that of an alias
with flexibility (it can manage the alias like it want to) and ease of use.
What do you think?
This are some valid questions, I will address them as soon as I can
Hello!
Any new updates?
By the way.
Two new points:
Hi,
I know it is not a feature of Silex, but still, this is very useful one. Care to merge this PR :) ?