Welcome Guest, Not a member yet? Register   Sign In
Getting Objects related objects in an array or object in datamapper-codeigniter ORM
#1

[eluser]mak.gnu[/eluser]
I'm trying to get an result of an classified objects and its all related images

Here is a relationship in model

Code:
User has_one group  
    user has_many classified
    truck has_many classified
    classified has_one user  
    classified has_many images
    image has_one classified

here is my code co far
Code:
function preview($id) {
        $c = new Classified($id);
        $c->include_related('user/group',array('name'),FALSE);
        $c->where('id', $id)->include_related('truck', array('brandName', modelName'), FALSE)->get();

        $c->image->get();        

    }
The above code is not working, as expected.

I need an array
Code:
array(
  'id' => 1,
  'classified' => 'some name',
  'brandName' => 'brand',
  'modelName' => 'model'
  'image'=> array('
        1 => 'value',
        2 => 'value1',
        3 => 'value2',

     ')
  )




Theme © iAndrew 2016 - Forum software by © MyBB