Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Name requirement of Controller and Model is different when extending core lib

$
0
0
I'm trying to extend the original CI_Controller and CI_Model to meet some of my demands. But when I do this, I found that the name requirement of extending these two core libraries is different from each other.

First, I created a file called MY_Controller.php in /application/core, and then create a class whose name does not start with the default required "MY_":
PHP Code:
class A_Controller extends CI_Controller {
public function 
__construct()
    {}


You see, though I did not meet the naming requirement (which can be seen here Creating core libraries), it actually works.

But it behaves differently when extending CI_Model. If my MY_Model.php is like this:
PHP Code:
class A_Model extends CI_Model {
public function 
__construct()
    {}


Codeigniter will throw an error telling me that:
Code:
Message: /var/www/application/core/MY_Model.php exists, but doesn't declare class MY_Model

So is the naming strategy of extending CI_Controller and CI_Molde treated differently ?

Viewing all articles
Browse latest Browse all 14114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>