You don’t know php or other C-like language if you are doing so. :: means static method or variable.
self::model()->TXN = 1;
is like
5+7;
or other expressions. It does not store data. You need variables to do it.
The way to solve your issue exists try and find it. Or try to rewrite your code storing models data in variable. At first you need
$model = new Class();
outside the loop.
Ps: if you need good perfomance, AR is bad choice. Use Yii::app()->db->schema->commandBuilder->createMultipleInsertCommand() for your case. Available in latest version of Yii.