I just started using Kohana a couple days ago, and I have a few questions that I cant seem to find an answer to anywhere.
Using ORM, how can you package information before you send it off? If I have a user model, and each user has a username, email, date of birth, etc... how can I package information (like add the users age as a property) before I send it to the controller?
Using ORM again, I see that if you select a user, you can also select all things related to that user (ie: articles, comments, etc.). How can you order that related information before sending it to the controller?
ie:
<?php
$user = ORM::factory('user', $id);
$user->articles; // holds all articles belonging to a user.
// how can you order those articles dynamically?
In the view, how can you get information about a user who is logged in? Do you use Auth (Auth::instance()->get_user())
, or is there any other way?
Also, If you know any other tips/advice/qwerks about Kohana, please drop a line or two, you may answer a future question of mine.
Thanks.
Edit: Another question. Using the ORM, I want to be able to load all articles that posted, in which a user has made a comment.
comments table
comment_id
user_id
article_id
etc....
Using ORM, I can access all articles posted by a user, but how would I be able to access all articles in which the user has commented on?
Thanks