12 August 2009 at 12:50am
Sorry didn't spot that.
Fixed that and removed the var_dump statements but it gives me the same error.
To be honest I'm not really sure what I'm doing so I'm just trying to put your example together with the "Transforming a result to DataObjectSet" here: [url]http://doc.silverstripe.com/doku.php?id=sqlquery[/url].
It's this line that gives the error:
// template engine needs that to render RosterPage_alts.ss
Maybe I should just give up now hehe. I'm in way over my head with this code!
12 August 2009 at 1:26am
There was just a semicolon (;) missing
$this->memberData = $PlayerAlt; // assign the DataObjectSet to $this->memberData
I also moved the DB config to a member variable, since you use that in other functions too.
You also had a function to get each class individually... that's overkill. I rewrote the Members function, so that it does all that in one.
In the template you can now use: $Members(Paladins) instead of $Paladins. To output all Members, just use $Members as before.
Here's to complete class, hopefully there's no error in there :)
12 August 2009 at 4:22am
(Last edited: 12 August 2009 4:25am),
That template looks fine to me.
I guess there's a problem with the singleton('roster') statement. This will probably try to instantiate a class named "roster" which doesn't exist.. or doesn't have the required datafields.
I modified the code slightly, so that the first result set is simply returned as DataObject:
Let's hope this works, otherwise there's probably something wrong with the DB connection, but for other things it seems to work... If my new code doesn't work, you could switch on debugging to get a more detailed error message. To do so, add the following to mysite/_config.php
Edit: found another error in the code. Try the above (http://pastebin.com/m709e0480), it should be ok now