0

I have some functionality in namespace:

namespace LyteeAPI\Models\Order;

Now, I need to call SaveOrder() function, that resides in a controller in different namespace:

namespace Lytee\Library\Helpers\Backend

in controller Erp.

I need it to be a bit more dynamic, so I'm calling this controller like:

$erpApi = 'Lytee\Library\Helpers\Backend\\' . 'ErpApiClient';
            if( \class_exists($erpApi))
            {
                $erpApiClient = new $erpApi($erpConfig);
                $erpResult = $erpApiClient->saveOrder($this);
            }

$erpApiClient gets constructed, if I var_dump it, it has proper properties and functions (via get_class_functions()).

If I call

$erpApiClient->saveOrder($this)

without parameter $this, I get php error about missing arguments for this function, which tells me, that php knows which function to call.

But I never seems to reach inside of this function. Whatever I do in this saveOrder() function, it doesn't get executed..

Logs don't show any errors if function call is correct..

What am I missing here?

2
  • 1
    If you add a return type to saveOrder what happens?
    – Arthur
    Oct 25, 2022 at 16:48
  • I had to move forward, so I was forced to do it differently, but thank you anyway for trying to analyze.
    – SubjectX
    Oct 27, 2022 at 6:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.