21293 Posts in 5733 Topics by 2602 members
|Go to End|
17 July 2010 at 3:04am Last edited: 17 July 2010 8:16am
I'd like a DataObject::get call to return what it normally does, plus another field with the same value for each row (I won't bore you with why)
I thought I could use the join parameter to create a cartesian result-set thus:
$results = DataObject::get('AcademicVideoPage', null, null, "INNER JOIN (SELECT $this->vpid AS `vpid`) AS `v`");
However, whenever I try to output $vpid to the template, nothing is inserted. All the normal AcdemicVideoPage fields are there though.
doing a var_dump on $results confirms that vpid is not there.
What exactly am I doing wrong here - the documentation seems to imply that I can do it this way, but I may be misreading/misunderstanding.
Many thanks for any help.
Version 2.3.3, OS X
17 July 2010 at 3:30am
Figured out why:
Because the join param does not force the get method and the method it then uses in turn to include the fields in the join as part of the returned field list.
OK, well, looks like it's manual SQL using SQLQuery then!
|Go to Top|