Kohana v3

Kohana ORM and PDO Revisited

Few days ago I posted about using Kohana ORM module with PDO driver. As I went developing some basic CRUD using ORM, I found out from a very old post in the forum that ORM only needs very few information about table columns. And it turns out that what I really need was the very least of it.

Although I cannot find the old link to Kohana forums anymore, it states that although ORM list columns and this list contains bunch of information about the column, ORM only needs a very few of it. Well, that is an old post. Now, I take it to the next level that I tried to strip out all information and leaving each column info empty with just the key for the column name left.

For every model you create, define a table_columns property listing the table columns like this for example:

protected $_table_columns = array(
    'id' => array(),
    'name' => array(),
    'description' => array(),

Currently it works on my setup. However, be careful when using other modules that may depend on other column information as this will not work. However, I don’t find such module yet.

Leave a reply

Your email address will not be published. Required fields are marked *