Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 574731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:51:45+00:00 2026-05-13T13:51:45+00:00

I just started using Kohana a couple days ago, and I have a few

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:51:46+00:00Added an answer on May 13, 2026 at 1:51 pm

    If you are using Kohana v3, you can order records like so:

    $articles = ORM::factory('user', $id)->articles
                                         ->order_by('date', 'DESC')
                                         ->find_all();
    

    If you are using Kohana v2, the same thing can be achieved using:

    $articles = ORM::factory('user', $id)->orderby('date', 'DESC')
                                         ->articles;
    

    And you were correct about accessing the user record through Auth::instance()->get_user() (if you are using the ORM Auth driver)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using Rails a few days ago, and I'm having trouble with
I just started using/learning Python and have some questions. I have a text file
I've only just started using Kohana ( 3 hours ago), and so far it's
I just started using jQuery in the past few days. I love how it
I just found web2py a couple days ago, and have been reading the documentation
I just started using Coderush and found some stuff that I used to have
I just started using SVN, and I have a cache directory that I don't
I just started using Eclipse but already I have a small problem. At first
I just started to using the Kohana framework and I'm trying to execute a
Just started using Blueprint CSS and now playing with the grids but have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.