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