• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can't create instance of a model class in models from controller class

Abstract of problem is this :

in app/controllers dir,  i have  files such as Home.php , News.php with class names matching

From  index method of Home class i can do this :

class Home extends BaseController
    public function index()
    $handle= new News();

i.e I can create an instance of a class located in /app/Controllers from another class , the file  holding it also in controllers.

With a simple class in Models directory however i get : 

Class 'Andy\UserModel' not found

the Andy comes from me trying namespace global permutations.

the dir with codeigniter is called CI and is located at /var/www/htdocs apache on slackware

echo of APPPATH gives : /var/www/htdocs/CI/app/

i've checked permissions of files in /var/www/htdocs/CI/app/Models/ and they are at least read for all

set up on apache (i don't know if this has anything to do with it) is via virtual hosts eg

  <Directory /var/www/htdocs/CI/public>
 Options Indexes   FollowSymLinks
Require all granted
AllowOverride All
ServerAdmin [email protected]
  ServerName CI.org
    DocumentRoot /var/www/htdocs/CI/public/
    ServerAlias www.CI.org
    #ErrorLog "/var/log/httpd/dummy-host.example.com-error_log"
    #C<ustomLog "/var/log/httpd/dummy-host.example.com-access_log" common

using  home page works , a route a added works and from a controller i can access from a sqlite3 database. I was moving function of database data access from controller to model when found problem.

Any ideas?

Messages In This Thread
can't create instance of a model class in models from controller class - by captain-sensible - 11-11-2019, 12:13 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.