I have the following function in a page controller:
function newCount() {
$outfits = DataObject::get('OutfitPage');
$outfitCount = $outfits->Count() - 1;
return $outfitCount ? $outfitCount : 0;
}
and it's giving the following error:
Fatal error: Call to a member function Count() on a non-object in /home/robynmat/public_html/ss/mysite/code/OutfitHolder.php on line 41
Any idea of the possible reasons for this? As far as I can see it was working fine that code until a larger amount of objects (OutfitPage) were created (i.e. around 30 or so). Or maybe something else changed but I can't think of what.
Help/ideas would be much appreciated :)
Cheers