BUGFIX: Fixed GridField::getModelClass() not to access protected property.

This commit is contained in:
Sam Minnee 2012-01-10 16:59:28 +13:00
parent 3c1d62acfd
commit c0d891cc0b

View File

@ -123,7 +123,10 @@ class GridField extends FormField {
*/
public function getModelClass() {
if ($this->modelClassName) return $this->modelClassName;
if ($this->list && $this->list->dataClass) return $this->list->dataClass;
if ($this->list && method_exists($this->list, 'dataClass')) {
$class = $this->list->dataClass();
if($class) return $class;
}
throw new LogicException('GridField doesn\'t have a modelClassName, so it doesn\'t know the columns of this grid.');
}