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 8763865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:53:02+00:00 2026-06-13T15:53:02+00:00

I have a problem when I want to query table using ORM ,example I

  • 0

I have a problem when I want to query table using ORM ,example I have article table with field id,author,text.

My code like this :

// Single where
$article = Model_Article::find()->where('id', 4);
print_r($article);

that’t code will be fetch all field on table article, it’s like select * from article where id = 4

Try Possibility

$article = Model_Article::find(null, array('id','title'))->where('id', 3);

the response is

object(Orm\Query)#89 (14) {
  ["model":protected]=>
  string(10) "Model_Article"
  ["connection":protected]=>
  NULL
  ["view":protected]=>
  NULL
  ["alias":protected]=>
  string(2) "t0"
  ["relations":protected]=>
  array(0) {
  }
  ["joins":protected]=>
  array(0) {
  }
  ["select":protected]=>
  array(1) {
    ["t0_c0"]=>
    string(5) "t0.id"
  }
  ["limit":protected]=>
  NULL
  ["offset":protected]=>
  NULL
  ["rows_limit":protected]=>
  NULL
  ["rows_offset":protected]=>
  NULL
  ["where":protected]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(9) "and_where"
      [1]=>
      array(3) {
        [0]=>
        string(5) "t0.id"
        [1]=>
        string(1) "="
        [2]=>
        int(3)
      }
    }
  }
  ["order_by":protected]=>
  array(0) {
  }
  ["values":protected]=>
  array(0) {
  }
}

that’s is not return id or title field.

but when i’m try by adding get_one() method

$article = Model_Article::find(null, array('id','title'))->where('id', 3)->get_one();

id is return , but title is not and another field, i don’t know why ?

Reference

  1. ORM Discussion FuelPHP it’s say ORM currently will be select all column, no plans to change that at the moment.

My Problem

  1. Select Custom Field using ORM like this select id,owner from article where id = 4 it’s will be return only id & owner, Is Possible to get that using ORM on FUELPHP ?
  • 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-06-13T15:53:04+00:00Added an answer on June 13, 2026 at 3:53 pm

    Do not use

    Model_Article::find()->
    

    but use

    Model_Article::query()->
    

    The first one works but is considered an error situation which might change in future versions.

    As of version 1.4 the ORM supports partial selects, using

    Model::query()->select('id', 'value')->
    

    The second parameter of find() is an array of conditions for the find, such as ‘where’ or ‘order_by’ clauses. There is no support for selecting column names in this array.

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

Sidebar

Related Questions

I have a problem. I want to use a LINQ query against this database:
I have this problem: I want to generate a new source code file from
I want to place UItextField in UITableViewCell but I have problem. Text field don't
I have a problem with using QueryDSL to create a query. I want to
I access a a postgres table using SQLAlchemy. I want a query to have
I am using GWT/JAVA for development. I have following problem: I want to remove
I have a problem when I want to sending data using byte format in
I'm have a problem when I want to query to the database , in
I have used this statements to populate jcombobox from MySql database table using Hibernate
I run into an interesting problem I want to understand. I have a table:

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.