0
votes

I am trying to create an class inside the model directory. This class(eg:- Admin) exposes only the methods which makes sense to the controller.

The Admin class will do all the joins and stuffs internally on tables(using ORM) and prepares data which can be readily consumed by the controller.

I have created 15 files in the model directory each of them representing a table in my database using the ORM method.

Now I want to create to create an instance of table within the Admin classes' get_All() method. I have tried to use Kohana::factory() which was unavailable in my Admin class. I tried to create the instance using the 'new', but it ended in an error which says that the specified class is not found.

My class definition for Admin is as follows

<?php defined('SYSPATH') or die('No direct script access.');

class Model_Admin {
public function get_All()
{
    $PD = new Model_PayPalData;
     echo 'Success';

}

}

The error is:

ErrorException [ Fatal Error ]: Class 'Model_PayPalData' not found APPPATH/classes/Model/admin.php

Please advice on how to deal with this situation.

Thanks for your attention

1
Include part of the class defenition + filename from Model_PayPalData please. Also it is ORM::factory(<classname>). Furthermore I'd not create a model to do the joins etc. but a (static) Helper_Admin class. - AmazingDreams

1 Answers

0
votes

Seem like your class is not loaded. You can check this by viewing the declared classes

get_declared_classes();

If it is't there, make sure to include it, or add it to the Models directory, if needed without extending the ORM class.