FrDeamon / EnseparHtml2pdfBundle

Html2pdf for Symfony 2 as a service.
MIT License
22 stars 22 forks source link

Wrong service id in the documentation #24

Closed Ddall closed 8 years ago

Ddall commented 8 years ago

In readme.md, the service identifier is "html2pdf.factory", it should be "html2pdf_factory"

Ddall commented 8 years ago

see pull request https://github.com/OwlyCode/EnseparHtml2pdfBundle/pull/25

xorgxx commented 8 years ago

hi i try to inject html2pdf_factory as service in one of my service class. i get same error :

Catchable Fatal Error: Argument 4 passed to EcommerceBundle\Controller\Services\PaymentService::__construct() must be an instance of HTML2PDF, none given

déclaration service

    ecommerce_payment_service:
        class: EcommerceBundle\Controller\Services\PaymentService
        arguments:
            - @doctrine.orm.default_entity_manager
            - @ecommerce_order_service
            - @messager.sender
            - @html2pdf_factory

déclaration class service

    use HTML2PDF;
    use JMS\DiExtraBundle\Annotation as DI;

       private $html2pdf;
..........
        /**
         * @DI\InjectParams({
         *     "em"                 = @DI\Inject("doctrine.orm.default_entity_manager"),
         *     "OrdersService"      = @DI\Inject("ecommerce_order_service"),
         *     "MessagerMailer"     = @DI\Inject("messager.sender"),
         *     "html2pdf"           = @DI\Inject("html2pdf_factory"),
         *
         * })
         *
         * @param EntityManager $em
         * @param OrdersService $OrdersService
         * @param Messager      $MessagerMailer
         * @param HTML2PDF      $html2pdf
         */
        public function __construct( EntityManager $em, OrdersService $OrdersService, Messager $MessagerMailer, HTML2PDF $html2pdf )
        {
            $this->em               = $em;
            $this->OrdersService    = $OrdersService;
            $this->MessagerMailer   = $MessagerMailer;
            $this->html2pdf         = $html2pdf;
        }
........

Thank for help.

xorgxx commented 8 years ago

ok i deed