Sorry, I wasn't aware that Profile and Videos has a relationship.
/C
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Sorry, I wasn't aware that Profile and Videos has a relationship.
/C
Hi Ryan,
Have you debugged what is coming before?
print_r($vids); die(); //see what values 'Featured' has before the find
$vids->sort('Created', 'DESC');
$videos = $vids->find('Featured', 'true');
Barry
Hi Swaiba, yea if you notice one of my previous posts, it said I tried one line earlier and it returned all the dataobjects available. It's the find() function that doesn't work. =(
doh! I guess what I meant to ask is what is the data... the find function looks simple so it'd help to see the data... btw I wrap my output buffering around my print_r's so I can log 'em if it helps...
ob_start();
print_r($arr);
$var = ob_get_contents();
ob_end_clean();
The data displayed is a DataObjectSet of the DataObjects returned by this:
$vids = new DataObjectSet();
foreach($videoIDs as $id) {
$record = DataObject::get_by_id("Video", $id);
$vids->push(new ArrayData($record));
}
$vids->sort('Created', 'DESC');
Actually, that is not how I've ever done it...
instead of...
$vids->push(new ArrayData($record));
i use...
$vids->push($record);
...does that help?
I'll give it a try. That's not how the SS documentation for DataObjectSet says how to do it though... lol, these guys need to update the documentation. =)
well code is often the best documentation :)
throughout the code ss creates DataObjectSets with $dos->push($do) or $dos->push(new ArrayData(array(...))), what you've got is $dos->push(new ArrayData($do)) where ArrayData and DataObject are both similar sorts of classes, not like when ss creates a ArradyData with an array of values.
EDIT on this it looks like arraydata takes both as arguments to it's constructor and it may not make any difference...