Anyone with a better solution, via AR maybe, to this:
$sql = "INSERT IGNORE INTO permission_group(name) VALUES(:name) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id)";
$command = $connection->createCommand ( $sql );
$command->bindParam ( ":name", $sName, PDO::PARAM_STR );
RDBMS-specific functions are not available through ActiveRecord. With the current implementation it’d be hard to configure it this way as well.
I think your solution is semantic, readable and secure. If you, however, really want to use AR, the only path I can see is to check row existence (CActiveRecord::exist()) and insert or update accordingly.
What does PDO::PARAM_STR do?
From my PHP manual:
PARAM_BOOL, PARAM_NULL, PARAM_INT, …