Jesse Jesbu Thu Feb 06 06:39:02 -0500 2014

Subject: Association from table1 to table2, 'has_one'

Hello!

I'm trying to create association to my invoice rows model.
There's column "project_task_id" in "invoice_has_items" table.

That refers to "project_has_tasks" table "id"-column.

Now I should be able to associate that to my "InvoiceHasItems" model.

I've tried so far:

class InvoiceHasItem extends ActiveRecord\Model {
static $table_name = 'invoice_has_items';

static $has_one = array(
array('project_has_tasks', 'foreing_key'=>'id')
);
static $alias_attribute = array(
'project_task' => 'project_has_tasks_id'
);
}

But no success :/
Thanks for help.