Welcome Guest, Not a member yet? Register   Sign In
Jamie Rumbelow's Flare O/R Mapper for CI - anybody playing around with it?


I spent quite a while now playing around with Jamie Rumbelow's Flare O/R Mapper for CI (yesterday's version which is still labeled as version 0.1.0, but it now comes with some helpful code comments).

After managing to get the example to work I started exploring into the more advanced features.

Here are my results:

1) I managed to overload $primary_key with the column name of my table which is different to the default 'id'.

I did it this way in my controller:

Customer::$primary_key = 'cid';


table name: customers
controller: customers
model: customer_model

Can anybody maybe give me a hint if this is the proper way to do the overloading?

$primary_key is declared 'static' in the Flare lib:

* The name of the primary key. Defaults to
* ID but can be overloaded if needs be.
* @var string
static $primary_key = 'id';

I am asking because I am not very 'fluent' in OO.

2) After that success I expected it to be easy to also change the table that is queried as the doc comments state:

* The table name, automatically generated
* based on the class name (pluralised). Overload
* if you have funky table names.
* @var string
static $table;


Customer::$table = 'my_table_name';

did not work, there must be more to this which I could not figure out.

3) After being able to successfully retrieve all properties (columns) with

$this->data['post'] = Customer::find($id);

I was pretty sure that

$this->data['post'] = Customer::find($id, array('select' => 'login_name'));

would only return the 'login_name' property/column, but this didn't work either.

Overall I am very impressed what is possible with Flare, I just need to get these things sorted out to start really working with it.

So, maybe there are a few more advanced users here who can give me a little bit of help, that would be really nice and highly appreciated.

Messages In This Thread
Jamie Rumbelow's Flare O/R Mapper for CI - anybody playing around with it? - by El Forum - 12-16-2009, 06:26 PM

Theme © iAndrew 2016 - Forum software by © MyBB