I'm trying to get all DataObjects of my custom Page-Type "MediaReports" with DataObject::get. All MediaReports have a DateField and I would like to output them for the current year (and seperate them from the older ones).
I tried
function getMediaReports_ThisYear() {
$today = date('Y');
return DataObject::get("MediaReport", "Year = '{$today}'", "Date DESC", "", "");
}
which works well with a NumericField called "Year". But I'd like to get this automatically from my DateField without declaring an extra NumericField. Can somebody help me?