You can provide an options_callback for the category field
the callback should looks like this:
Code:
public function listCategory(DataContainer $objDc) {
$brand = $objDc->activeRecord->brand; // assuming your brand field is named brand
// the following depends on how you named your fields :)
$res = $this->Database->prepare('SELECT id,name FROM category WHERE brand=?')->execute($brand);
$k = $res->fetchEach('id');
$v = $res->fetchEach('name');
if (is_array($k) && is_array($v)) {
return array_combine($k, $v);
}
return array(''=>'no category for the brand');
}
Bookmarks