Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

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.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Force ignore case


Go to End


9 Posts   3651 Views

Avatar
MateuszU

Community Member, 89 Posts

22 February 2010 at 1:12pm

DataObjectSet is like an array, it contains a list of DataObjects, and it will not have a Title. First you need to iterate on the DataObjectSet by using:

if ( $items ) foreach ( $items as $item ) {
$item->Title;
}

or if you just want first item:

if ( $first = $items->First() ) {
$first->Title;
}

How are you getting your $item? Cause if you get it via get_one you will get proper DataObject and you can query for Title directly. If you do only get, then you will get the set of DataObjects and you need to iterate.

mat

Go to Top