0

I am using a function from codeigniter controller which calls a model called payment plan for me to use. I have been using this method all over the place but this is the first time I am getting a problem with it. The error is Fatal error: Call to a member function createPaymentPlan() on a non-object in I am not sure what I am doing wrong but here is the code.

            $this->load->model("payment_plan");
            $this->load->model("fee_page");

            foreach ($itemdetails as $itemdetail) {
                $Amount = $itemdetail["borrowOrInvestAmount"];
                $currency = $itemdetail["Currency"];
                $Interest = $itemdetail["Interest"];
                $Loantime = (isset($data['Loantime']) && $data['Loantime'] > 0) ? $data['Loantime'] : $itemdetail["Loantime"];
                $start_date = $data["start_date"];
                $payment_term = $data["payment_term"];                   

                $paymenPlanSingle = $this->payment_plan->createPaymentPlan($Amount, $currency, $Interest, $Loantime, $start_date, $payment_term);
                $countOfElements = count($paymenPlanSingle);
             }

The second it reaches payment_plan it crashes even though I loaded the controller already.

2 Answers 2

1

Everything looks okay. Most of the time this problem is occurs due to a loading of controller before. Check if you are loading any controller before or not, if you are, please load the model "payment_plan" before it.

Sign up to request clarification or add additional context in comments.

Comments

0

Check the controller does not overwrite var

$this->payment_plan

if you can show the controller and model payment_plan

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.