Friday, 6 September 2013

ModelAdmin DataObjects

ModelAdmin DataObjects

I have this class:
class Product extends DataObject { static $db = array('Name' => 'Varchar',
'ProductType' => 'Varchar', 'Price' => 'Currency'); }
The database table looks as follows:
Name ----------------- ProductType --- Price
Product 1------------- Type1----------100
Product 2-------------- Type1---------- 240
Product 3---------------Type2 ----------10
Product 4--------------- Type1--------- 100

I would like to have 2 model admins:
class MyFirstModel extends ModelAdmin {
public static $managed_models=array(
Product
);
class MySecondModel extends ModelAdmin {
public static $managed_models=array(
Product
);
What is the best way to come to this result: MyFirstModel should show me
all entries where ProductType in table is Type1 And MySecondModel should
show me all entries where ProductType in table is Type2

No comments:

Post a Comment