Getting extended Page class with Pagelist

Permalink
I would like to create a class that extends Page. Page::getById() offers a way to retrieve objects of the child class. Pagelist on the other hand doesn't seem to offer this possibility. Does anyone know if this could be made possible in a simple way?

Ronald72
 
RadiantWeb replied on at Permalink Best Answer Reply
RadiantWeb
I have an article on this here:

http://chadstrat.com/blog/programming/extending/...

ChadStrat
Ronald72 replied on at Permalink Reply
Ronald72
Thanks, I think this is the way to go but I haven't found how to retrieve extended Page class objects.

In your case I would like to make a class called Promotion which extends Page. The method get() of PromotionList should then not return an array of Page-objects, but an array of Promotion-objects. This way I could create a nice model (Promotion class) with specific methods and properties.

Page::getByID offers the possibility to retrieve a Promotion-object instead of a Page-object. I thought PageList would also offer this functionality, but it doesn't. It should probably be done by altering some method in PromotionList, but I couldn't easily find which one. Lazy as I am I thought I might see if someone already did do this. :-)