I have a model, Application_Model_DbTable_Login, located in Application > models > DbTable > Application_Model_DbTable_Login.php.
In my controller, LoginController, I am trying to instantiate the Model, but it's saying that it can't find it. Here is the exact error: Fatal error: Class 'Application_Model_DbTable_Login' not found in /usr/local/zend/apache2/htdocs/AssetLibrary/application/controllers/LoginController.php on line 8.
I just started working with Zend Framework. Thanks for any help.
Rename the file
Application_Model_DbTable_Login.php to Login.php
and ensure the class within is defined as
<?php
class Model_DbTable_Login extends Zend_Db_Table_Abstract
{}
Then in your controller call
$model = new Model_DbTable_Login();
Related
I have created under application/core folder a file called Auth_controller.php.
I am using CodeIgniter 3.
php 5.3.3
Centos 6.9
The content is
class Auth_Controller extends CI_Controller{
in config file i declare
$config['subclass_prefix'] = 'Auth_';
Then finally when i called it...
class Home extends Auth_Controller {
it gives me a
Fatal error: Class 'Auth_Controller' not found in /var/www/html/calllist/application/controllers/Home.php on line 3
Message: Class 'Auth_Controller' not found
You using $config['subclass_prefix'] = 'Auth_'; settings means you want to extend core CI classes.
If you want to extend CI_Controller then you class name should be Auth_Controller if you want to extend model your class name should be 'Auth_Model'
But Remember those classes/files should be inside your application\core folder
For more details please look at CI documentation
The location of Auth_Controller must be in application\core directory. Otherwise you need to manually include class to your controller file.
You need to include Auth_Controller like below mentioned code.
<?php
require_once("secure_area.php");
class Reports extends Secure_area {
Hello guys i created Entity folder inside application/model/. In Entity folder i created file Mj_user.php and give class name as same Mj_user.
but when i try to access that class using
$User= new Entity\Mj_user;
it's giving me error
Fatal error: Class 'Entity\Mj_user' not found in C:\xampp\htdocs\project\application\controllers\user.php on line 15
what should i do Please help me..but when i remove Mj_ then put only file name as User.php. Its working properly..Please help me
When creating a new class you have to be careful, the name of the class must be:
class Mj_user extends CI_Model {
function __contruct()
{
partent::construct();
}
}
The file must be mj_user.php and for using this model you must load it before start using it
it can be preloaded for all in the configuration or you can load it whenever you need it like this
$this->load->view('mj_user');
And in the error seems that is looking for a file called user.php and should be mj_user.php
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
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.
I know there are other similar questions, but even after following all the syntax, this errror exists
I am using Codeigniter version 2.1.4 on wamp server, windows 7.
in application/core/ i have MY_Basedbclass.php starting with
abstract class MY_Basedbclass extends CI_Model
{
and trying to use it in my mode like
class Accounts_manager extends MY_Basedbclass
{
ending up with the error - Fatal error: Class 'MY_Basedbclass' not found in C:\wamp\www\party_app\server\application\models\accounts_manager.php
Please suggest what i am doing wrong. Thanks
EDIT - Addign a screen shot for the file structure sake
why you define your core model class as abstract class? after that you can only set core model class as MY_Model. this name get from subclass_prefix + class_name_you_want_to_over_write
define your core class like this:
class MY_Model extends CI_Model {
// your code
}
before that assured in your config.php file you set $config['subclass_prefix'] = to MY_
config file address: application > config > config.php
I'm working with a Zend Framework project and using the ZF tool from the command line. After setting up some initial structure, I extended the Zend_Controller_Action class with something like MySite_Controller_Action and made the existing controllers point to that. So now I have something like:
class IndexController extends MySite_Controller_Action
{ ... }
and
abstract class MySite_Controller_Action extends Zend_Controller_Action
{ ... }
The problem is that now when I attempt to run a command like
Bash$ zf create action edit Index
I get an error like this:
Creating an action named edit inside controller at /Library/WebServer/Documents/MySite/application/controllers/IndexController.php
PHP Fatal error: Class 'MySite_Controller_Action' not found in /Library/WebServer/Documents/MySite/application/controllers/IndexController.php on line 3
Fatal error: Class 'MySite_Controller_Action' not found in /Library/WebServer/Documents/OurMods/application/controllers/IndexController.php on line 3
Can anyone offer up any ideas? I've done a little searching, but I don't even know where to start on this one.
NOTE: I HAVE loaded a 'MySite' namespace via the application.ini file as follows:
autoloadernamespaces.MySite = "MySite_"