3373 Posts in 998 Topics by 712 members
|Go to End|
25 April 2013 at 3:25am
I have a data object called ImageLink which extends DataObject and a data object called Promo which in turn extends ImageLink. In my page I have two has_many fields - one for ImageLinks and one for Promos.
static $has_many = array(
"ImageLinks" => "ImageLink",
"Promos" => "Promo"
Since Promo inherits from ImageLinks, when I get/loop the ImageLinks items they also include the Promo items stored in the Promos field. Is this the intended behaviour? I'm not interested in getting any subclasses. When looping the ImageLinks i only wish to get the ImageLinks! I understand where the problem comes from, since all ImageLinks and Promos are stored in the same table in the database.
At the moment, I have to filter the ImageLinks array on "ClassName" = "ImageLinks", but it would be better if this worked out of the box.
|Go to Top|