I have two MySQL-Tables (oversimplified):
articles
- id
- description
article_attributes
- article_id
- attribute_name
- attribute_value
So, every article
can have an unlimited amount of attributes
.
For the articles
i have a Kohana_ORM Model
<?php class Model_Article extends ORM {} ?>
When loading the Model I would like to have access to all the attributes.
Example:
<?php
$article = new Model_Article(1); // or ORM::factory('article', 1);
echo $article->description;
echo $article->attribute->foo;
echo $article->attribute->bar;
?>
Could someone please point me in the right direction how to achive this?