So I have a situation where a single class has 3 has_many relationships to a dataobject. I've got it setup as follows:
class DistributorsPage extends Page {
public static $has_many = array(
'Restaurants' => 'Distributor.Restaurants',
'Retails' => 'Distributor.Retails',
'Wholesales' => 'Distributor.Wholesales'
);
}
class Distributor extends DataObject {
static $has_one = array(
'Restaurants' => 'DistributorsPage',
'Retails' => 'DistributorsPage',
'Wholesales' => 'DistributorsPage'
);
}
Which seems to have worked fine, and has created the correct database columns of WholesalesID, RetailsID, RestaurantsID on the Distributor table.
The issue I'm having though is that for the three DOM tables (and the same for CTM tables) all display the same results, which seems to be whichever relation I have last in the has_one declaration. So if I move the 'Restaurants' relation to last, the results for Restaurants will be displayed on all three relation tables in the admin.
This is my DOM code:
$restaurantManager = new DataObjectManager(
$this,
'Restaurants',
'Distributor',
array(
'Name' => 'Name',
'State' => 'State'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab( 'Root.Content.Restaurant', $restaurantManager);
Anyone see anything I'm doing wrong, or is this a bug in the core? As an aside, setting the source class to "Distributor.Restaurants" causes a bad singleton error for a class that doesn't exist.