Hello All,
I am just diving into SilverStripe and I'm Loving it!
My Challenge:
I have an eCommerce cart installed with my silverstripe site and I need to pull data from the store into a SilverStripe template.
Normally this is cake with the DataObjectSet, However I run into two problems:
1. Converting my result to an DataObjectSet is giving me an error. How do I setup the object set to convert from this SQL statement:
$sqlQuery = new SQLQuery();
$sqlQuery->select = array(
'ds_photos.objectID as ProductId',
'ds_photos.photoName as Url',
'ds_language_photos.pCaption as Caption');
$sqlQuery->from = array("ds_photos","LEFT JOIN ds_language_photos ON ds_photos.photoID = ds_language_photos.photoID");
$sqlQuery->where = array("ds_language_photos.pAlt LIKE '%SIA%'");
// get the raw SQL
$rawSQL = $sqlQuery->sql();
// execute and return a Query-object
$result = $sqlQuery->execute();
// let Silverstripe work the magic
$myDataObjectSet = singleton('Player')->buildDataObjectSet($result); //this is the line that is giving me problems as 'Player' is not defined and I'm not sure how to map this out right.
2. Also is there a way to use <% control %> to go through my raw SQL result?
Thanks for your time!