CodeIgniter Forums

Full Version: Datamapper returns only the last variant ... :( :( :( ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]pesho_h_k[/eluser]
I'm using Datamapper 1.6 ... but the get() method only returns me the last variant from the real results array ... Sad

I dumped all the time, even inside the get method of the datamapper library ... but its only getting worse ...

so :


Code:
$news = new bgnews;
$news->get_where( array( 'active' => 'Y' ) );

and now - dump $news->all ...
and in the foreach cycle:

Code:
foreach( $news->all as $n ) {
   die var_dump( $n ) );
}

or

Code:
foreach( $news->all as $n ) {
   die var_dump( $n->stored ) );
}

...

but always returns the last one ... Sad

can u help me please Smile

El Forum

[eluser]pesho_h_k[/eluser]
well ... I found it Smile

in the _to_object method - at the end we have:

Code:
$items[$item->id] = $item;

but when I dump $item->id - I have always NULL ... so I placed:

Code:
if( isset( $item->id ) ) {
    $items[$item->id] = $item;
} else {
    $items[] = $item;
}


and now I have all the result items after the get() method Smile ...



(but after all - again the frustration remains Sad ... that I must change something in a framework to make it work ... not just use it ... Sad ... fuck shit! ...)