My first sfServiceContainer

39 views
Skip to first unread message

umpirsky

unread,
Nov 18, 2010, 9:23:46 AM11/18/10
to Symfony Components
Hi folks.

I'm new to Symphony components. Have read about dependency injection
component, and have some questions.

In example http://components.symfony-project.org/dependency-injection/trunk/book/03-Service-Container
(class Container extends sfServiceContainer) get*Service() methods are
protected, probably because sfServiceContainer need to check if
service is already created and get it from $this->services[$id] if
yes. Why then getMailerService() is trying to get it from self::
$shared['mailer']?

Services are magically hidden in the container so I get no code
completion by my IDE. Any idea how to make it work, or that is not
possible?

I'm looking for the right way to go implementing my service container
for my services in zf based project which will be based on
sfServiceContainer. Any tips, examples, github links are welcome.

Thanks in advance.

Loïc Frering

unread,
Nov 21, 2010, 1:24:52 PM11/21/10
to symfony-c...@googlegroups.com
You should have a look to losolib which integrate Symfony DI Container into ZF applications. Check the wiki for more informations.


--
You received this message because you are subscribed to the Google Groups "Symfony Components" group.
To post to this group, send email to symfony-c...@googlegroups.com.
To unsubscribe from this group, send email to symfony-compone...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/symfony-components?hl=en.




--
Loïc Frering
loic.f...@gmail.com

OZ

unread,
Nov 23, 2010, 5:53:23 PM11/23/10
to Symfony Components
Well, maybe it's not most correct way, but you can try to use phpDoc
description, /** @method ... */

On 18 ноя, 17:23, umpirsky <umpir...@gmail.com> wrote:
> Hi folks.
>
> I'm new to Symphony components. Have read about dependency injection
> component, and have some questions.
>
> In examplehttp://components.symfony-project.org/dependency-injection/trunk/book...

Саша Стаменковић

unread,
Nov 24, 2010, 1:59:16 AM11/24/10
to symfony-c...@googlegroups.com
Thanks people, I managed to use it as it is. I'm ading constants to my container with service ID, and then use it like myContainer->getService(myContainer::SERVICE_ID).

Regards,
Saša Stamenković


Reply all
Reply to author
Forward
0 new messages