public function __construct($setDefault = true) { parent::__construct(); if ($setDefault) { $this->setDefault(); } }
public static function save(Model $model) { $params = []; $query = 'INSERT INTO core_role_permission (role_id, permission_id) VALUES (?,?)'; $query .= ' ON DUPLICATE KEY UPDATE '; $params = [$model->getRoleId(), $model->getPermissionId()]; $query .= 'role_id = ?, '; $params[] = $model->getRoleId(); $query .= 'permission_id = ?, '; $params[] = $model->getPermissionId(); $query = rtrim(trim($query), ','); $db = new Util\Data(); return $db->execute($query, $params); }