CodeIgniter Forums
Extending CI_MODEL but nothing.... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Extending CI_MODEL but nothing.... (/showthread.php?tid=58145)

Pages: 1 2


Extending CI_MODEL but nothing.... - El Forum - 05-22-2013

[eluser]andreffonseca[/eluser]
Hi people...

I've done some debugging and for some reason not known to me the __get method of the class CI_Model is never called...

I'm completely lost....




Extending CI_MODEL but nothing.... - El Forum - 05-23-2013

[eluser]TheFuzzy0ne[/eluser]
That doesn't surprise me, since CodeIgniter doesn't seem to have assigned the model as a property of the super-object.

I know this is turning into a lot of work for a simple tutorial which should work (and in most cases does), but please could you zip up your application (including the system directory and any .htaccess file you might have), upload it to a filesharing Web site, and post the link on here? I'd like to see if I can replicate the problem.


Extending CI_MODEL but nothing.... - El Forum - 05-23-2013

[eluser]andreffonseca[/eluser]
Hi TheFuzzy0ne .

This is no a tut i'm doing... i'm trying to dev something. I used to use another version of CI, but i now i return to CI (work demand) and got the last version....and this change Sad

I will do what you ask, but the structure is the same as in CI zip.

Thanks in Advance.


Extending CI_MODEL but nothing.... - El Forum - 05-23-2013

[eluser]TheFuzzy0ne[/eluser]
Indeed, but the fact that I don't have the same problem, and you do, indicates to me that it's either something not right in your code, or some kind of problem with your server setup.

If I can test it out, I should be able to confirm which it is. Smile


Extending CI_MODEL but nothing.... - El Forum - 05-23-2013

[eluser]andreffonseca[/eluser]
OK...i'll upload the code Smile


Extending CI_MODEL but nothing.... - El Forum - 05-24-2013

[eluser]andreffonseca[/eluser]
This is so ...... if i do this in my model:

Code:
class Fieldvalidation extends CI_Model{

nothing work...but if i extend from CI_Controller like this...

Code:
class Fieldvalidation extends CI_Controller{

it work great ...

Ugly Solution: if i create like a class that inherited from CI_Controller like

Code:
class Mysuperclass extends CI_Controller{

and them in my controllers/models i extend from the Mysuperclass Smile

Code:
class Fieldvalidation extends Mysuperclass{

it's to ugly? Smile


Extending CI_MODEL but nothing.... - El Forum - 05-24-2013

[eluser]andreffonseca[/eluser]
Problem solved:

Code:
/**
* @var CI_Config
*/
var $config;

/**
* @var CI_DB_active_record
*/
var $db;

/**
* @var CI_Email
*/

var $email;
/**
* @var CI_Form_validation
*/

var $form_validation;
/**
* @var CI_Input
*/

var $input;

/**
* @var CI_Loader
*/

var $load;
/**
* @var CI_Router
*/
var $router;
/**
* @var CI_Session
*/
var $session;
/**
* @var CI_Table
*/
var $table;

/**
* @var CI_Unit_test
*/
var $unit;
/**
* @var CI_URI
*/
var $uri;

/**
* @var CI_Pagination
*/
var $pagination;

it was this in the model class (used for auto suggest in Netbeans) that was messing this up...god Sad
But this is only messing in the CI_Model class...got this in the CI_Controller class and everything is ok...strange


Extending CI_MODEL but nothing.... - El Forum - 05-24-2013

[eluser]TheFuzzy0ne[/eluser]
Well done! Glad you got it sorted. Please see here for an alternate method of getting Netbeans code-completion to work, but without declaring any variables.

http://ellislab.com/forums/viewthread/187949/


Extending CI_MODEL but nothing.... - El Forum - 05-24-2013

[eluser]andreffonseca[/eluser]
Thanks TheFuzzy0ne, already saw it Smile

Thanks for all.