More information about the Underscore mailing list

[_] codeigniter php framework

Jon Bennett jmbennett at gmail.com
Wed Mar 5 12:12:08 GMT 2008

> here's a basic comparison between the two to illustrate lines of code
>  between the 2 http://bin.cakephp.org/view/929254989
>
>  Now, if you add in associations, cake wins hands down
>  http://bin.cakephp.org/view/42078969

>From looking further, IMO CI just asks you to write code it should be
writing itself. Take this as an example:

<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class Page extends ActiveRecord {

    function __construct()
    {
        parent::ActiveRecord();
        $this->_class_name = strtolower(get_class($this));
        $this->_table = $this->_class_name . 's';
        $this->_columns = $this->discover_table_columns();
    }

}

?>

IMO, the "if (!defined('BASEPATH'))" conditional would be better
placed in a class that's inherited by all, or in a bootstrap or
something, I mean, should I really have to write that for EVERY file?

My next issue relates to:

function __construct()
{
    parent::ActiveRecord();
    $this->_class_name = strtolower(get_class($this));
    $this->_table = $this->_class_name . 's';
    $this->_columns = $this->discover_table_columns();
}

Why isn't the constructor of either ActiveRecord or the Model class
creating those properties automatically for me, with the option to
override if I require it?

Shouldn't the framework be handling this mundane stuff for me?

cheers,

jon
-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett