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.

Data Model Questions /

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

DataObject::get() returns NULL when no records are found?

Go to End



Community Member, 5 Posts

16 January 2012 at 10:35am

Edited: 17/01/2012 12:42am

Hi everyone,

I'm not sure I fully understand all the inners of DataObject yet, but I'm surprised to see that executing DataObject::get() with a filter that returns no record returns nothing, rather than an empty DataObjectSet. Is this normal?


// assuming that the database contains no record which Date > CURDATE()

$news_articles = DataObject::get("NewsArticle", "Date > CURDATE()");
return $news_articles; // This returns NULL.

Thanks for your help!