I am working on a website these days, for that I want to extend to Newsletter module mainly the newsletter class. The point is this, I want to add the latest blog posts on the newsletter. Now what I did was that I created a new class which extends the Newsletter. my class looks like this,
<?php
class ExtendedNewsletter extends Newsletter{
function pages(){
return DataObject::get("Page");
}
}
?>
And I added this code in my /mysite/_config.php
Object::useCustomClass('Newsletter', 'ExtendedNewsletter');
now the problem is that whenever I create a new draft it creates a Newsletter Object, not a ExtendedNewsletter. Anyone can tell me what is wrong here, and do I need to use a DataObject decorater instead of extending the Newsletter class?