Search Results

Search found 1 results on 1 pages for 'viyancs'.

Page 1/1 | 1 

  • How to custom query using ORM in Fuelphp?

    - by viyancs
    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 ORM Discussion FuelPHP it's say ORM currently will be select all column, no plans to change that at the moment. My Goal I want to query in orm like this select id,owner from article where id = 4 it's will be return only id & owner, how i can get that using orm ?

    Read the article

1