So I would have an array of users and country in a list ie.
Joe Bloggs - USA
Joe Smith - United Kingdom
Etc
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
September 05, 2008 12:32pm
Subscribe [115]#421 / Jan 23, 2009 6:39pm
So I would have an array of users and country in a list ie.
Joe Bloggs - USA
Joe Smith - United Kingdom
Etc
#422 / Jan 23, 2009 6:42pm
try this
$u = new User();
$u->get();
$u->country->get();
foreach ($u->all as $user)
{
echo $user->name.' -> '.$user->country->name.'
';
}#423 / Jan 23, 2009 6:43pm
Thats excatly the same as what I had ??
#424 / Jan 23, 2009 6:45pm
post your models for user and country
#425 / Jan 23, 2009 6:52pm
#426 / Jan 23, 2009 6:56pm
you dont have this part on the controller
foreach ($u->all as $user)
{
echo $user->name.' -> '.$user->country->name.'
';
}otherwise its not printing anything….
#427 / Jan 23, 2009 7:00pm
Like I have said I get the sQL error as per my first post. So no point outputting anything when I got errors 😊.
I know normal get works just for users with no errors and I have done foreach no problem with that data.
#428 / Jan 23, 2009 7:01pm
just to make sure you did update your mysql driver? if no check out the troubleshooting in the manual.
BTW do you have an instant messenger so we stop spamming the board?
#429 / Jan 23, 2009 7:43pm
Solution was to update the mysql driver….
#430 / Jan 23, 2009 9:28pm
@tdtank
Without diving into it too much something is amuck with autotransactions as turning it off in the datamapper config using similar models worked perfectly
controller
$b = new Brainstorm();
$b->short_desc = "test1";
$b->long_desc = "a long description";
$b->priority = 1;
$b->est_count_total = 77;
$b->status = 1;
$b->origin_date = now();
$it = new Issue_type();
$it->where('id', 2)->get();
$b->save($it);
var_dump($b);A Debug shows that DataMapper line 614
$this->id = $this->db->insert_id();which uses the new mysql_driver.php insert_id method on line 310
returns an id of 0
but with the config set to false it properly returns the id of the newly created record
so yeah… something is amuck in the driver i think?
#431 / Jan 23, 2009 10:21pm
hmmm…. also turning autotransactions back on and reordering DataMapper lines 604 - 615 to the following worked too:
// Begin auto transaction
$this->_auto_trans_begin();
// Create new record
$this->db->insert($this->table, $data);
// Sets the id property
// to the last insert's auto_increment value
$this->id = $this->db->insert_id();
// Complete auto transaction
$this->_auto_trans_complete('save (insert)');#432 / Jan 24, 2009 5:13pm
Has Datamapper ceased to exist….?
#433 / Jan 24, 2009 5:16pm
Not from what we know…
The creator is really busy at the moment…
you can download it from the wiki and the manual is in the download.
If you have questions ask them here and people will try and help!
#434 / Jan 24, 2009 5:18pm
Okay cool - it’s fantastic contribution and was worried when I saw that.
#435 / Jan 24, 2009 5:50pm
I recently talked to stensi. He’s going through a server change, and it might be a little longer before he gets his website up.
DataMapper is still alive and kicking, however, and some additions are in the works, AFAIK.