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 whereProductType
in table isType1
And
MySecondModel
should show me all entries whereProductType
in table isType2
getList()
should be the answer. DOC here http://doc.silverstripe.org/framework/en/reference/modeladmin#results-customizationSo something like:
If you have more than 2
ProductType
you can use an array to exclude multiple values like