I found the solution, I was misusing the DIC and the problem was
located in my compilerPass class. This works now I use Defintion and
Reference classes :
https://github.com/Palleas/ZendAMFBundle/blob/8eac073c1912ce45f612f6a7837258b58d5412ec/DependencyInjection/Compiler/ServicesCompilerPass.php

Anyway, I wonder how relevant the error I got really is. I suppose I
was at a step of the compilation process where my zendamf.server
service has been declared but is not really available, so that
explains the "new ReflectionClass(null)". Maybe it'd be better to have
a proper exception thrown ?

On 20 mai, 13:29, Palleas <[email protected]> wrote:
> Hi all,
>
> I'm having a weird issue with my Symfony2 Bundle. Basically I'm trying
> to use ZendAMF with Symfony2 and I'd like to inject the logger into my
> server instance so I can know what really happening on the PHP side.
> Anyway, that's what I'm doing :
>
> Extending the AMF server class :
>
> <?php
> namespace Palleas\ZendAMFBundle;
>
> use Zend\AMF\Server as BaseServer;
> use Symfony\Component\HttpKernel\Log\LoggerInterface;
>
> class Server extends BaseServer
> {
>     protected $logger;
>
>     public function setLogger(LoggerInterface $logger)
>     {
>         $this->logger = $logger;
>     }}
>
> ?>
>
> Creating my service (and injecting the logger) :
> <service id="zendamf.server" class="Palleas\ZendAMFBundle\Server">
>   <call method="setLogger">
>     <argument type="service" id="logger" />
>   </call>
> </service>
>
> And then using it inside my controller (it's still kinda dirty for
> know, but that's a WIP) :
> <?php
>
> namespace Palleas\ZendAMFBundle\Controller;
>
> use Symfony\Bundle\FrameworkBundle\Controller\Controller;
> use Symfony\Component\HttpFoundation\Response;
>
> /**
> *
> */
> class MainController extends Controller
> {
>     public function gatewayAction()
>     {
>         // Hey, how about dependency-injecting the controller?
>         $server = $this->get('zendamf.server');
>
>         return new Response((string)$server->handle());
>     }
>
> }
>
> Problem is, an Exception is thrown from the ContainerBuilder on line
> 668 :
> "ReflectionException: Class does not exist"
> (It's basically trying to do new \ReflectionClass(null)).
>
> I tried to inject the "kernel" too, but I have the same error.
>
> Am I missing something here? Is there another way to do this?
>
> Thanks !

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to