0

I am currently trying to install this extension into my magento 2.1.7 store. I unzipped the file and uploaded in the app/code directory of my site. I went through the steps and ran the following commands:

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy.

Then I ran the compile command and am getting the following error:

Errors during compilation:

Magenest\QuickBooksDesktop\Controller\Connection\Start
Incorrect dependency in class Magenest\QuickBooksDesktop\Controller\Connection\Start 

in /home/cartcybermarkpro/public_html/app/code/Magenest/QuickBooksDesktop/Controller/Connection/Start.php

\Magento\Framework\Controller\Result\RedirectFactory already exists in context object

Total Errors Count: 1

looks like the same error more than once. The extension partially shows in my backend. I am not sure what I am missing as their support isn't very helpful or responsive. Any ideas how to fix this? I need to get this installed today

<?php
/**
* Copyright © 2015 Magenest. All rights reserved.
* See COPYING.txt for license details.
*
* Magenest_QuickBooksDesktop extension
* NOTICE OF LICENSE
 */
namespace Magenest\QuickBooksDesktop\Controller\Connection;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Module\Dir\Reader;
use Magento\Framework\Module\Dir;
use Magenest\QuickBooksDesktop\WebConnector\Handlers\Queue ;
use Zend_Soap_Server as ZendSoapServer;
use Magento\Framework\Webapi\Rest\Request;
use Magento\Framework\Controller\Result\RedirectFactory;

/**
 * Class Start
 * @package Magenest\QuickBooksDesktop\Controller\Connector
 */
abstract class Start extends Action
{
    /**
     * @var RedirectFactory
     */
    protected $redirectFactory;

    /**
     * @var string
     */
    protected $_wsdl;

    /**
     * @var Queue
     */
    protected $_handlers;

    /**
     * @var ZendSoapServer
     */
    protected $_soapServer;

    /**
     * @var Request
     */
    protected $_requestWebapi;

    /**
     * Start constructor.
     * @param Context $context
     * @param Reader $configReader
     * @param Queue $handlers
     * @param ZendSoapServer $soapServer
     * @param RedirectFactory $redirectFactory
     * @param Request $request
     */
    public function __construct(
        Context $context,
        Reader  $configReader,
        Queue $handlers,
        ZendSoapServer $soapServer,
        RedirectFactory $redirectFactory,
        Request $request
    ) {
        $wsdlBasePath = $configReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magenest_QuickBooksDesktop') . '/wsdl/';
        $this->_wsdl = $wsdlBasePath . 'QBWebConnectorSvc.wsdl';
        $this->redirectFactory = $redirectFactory;
        $this->_handlers = $handlers;
        $this->_soapServer = $soapServer;
        $this->_requestWebapi = $request;
        parent::__construct($context);
    }

    /**
     * @return $this
     * @throws \Magento\Framework\Exception\InputException
     * @throws \Zend_Soap_Server_Exception
     */
    public function execute()
    {
        $method = $this->_requestWebapi->getHttpMethod();
        if ($method != Request::HTTP_METHOD_POST) {
            $resultRedirect =$this->redirectFactory->create();

            return $resultRedirect->setPath('/');
        }

        $soapClass = $this->_soapServer;
        $soapClass->setWsdl($this->_wsdl);
        $soapClass->setObject($this->getHandler());
        $soapClass->handle();
    }

    /**
     * @return mixed
     */
    protected function getHandler()
    {
        return $this->_handlers;
    }
}
0

Seems that they inject in the constructor the class

\Magento\Framework\Controller\Result\RedirectFactory 

even if they can take it from the context object like

$context->getResultRedirectFactory();

Replace the variable assignment they do for the resultRedirectFactory with the code above

|improve this answer|||||
  • WHere would I go about doing this? – user3096584 Jul 28 '17 at 18:07
  • I am new to magento and not really sure what you are asking me to do. Any additional information would help – user3096584 Jul 28 '17 at 18:10
  • please post the code of the file /home/cartcybermarkpro/public_html/app/code/Magenest/QuickBooksDesktop/Controller/Connection/Start.php – Nikolas Jul 28 '17 at 18:20
  • I have gone in and edited the question and paste the code – user3096584 Jul 28 '17 at 18:29
  • Any update on this? – user3096584 Jul 28 '17 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.