public function __construct(DataRow $row) { if ($row->getTable()->getTableName() !== DB::getRoleTableName()) { throw new SystemException('Wrong Role Table'); } $this->_data = $row->getAllData(); //load permission $this->loadPermission(); }
public function __construct(DataRow $row = null) { if ($row === null) { $this->_data = array('id' => 0, 'name' => '请选择科目'); $this->setTable(new Table('subjects')); } else { $this->_data = $row->getAllData(); $this->setTable($row->getTable()); } }