Extra Fields In Retrieving Data findBySql

I am using SQL Server 2008. Here is my syntax.

$region =TbAuditRegion::findBySql('SELECT ROW_NUMBER() OVER (ORDER BY date_created DESC) AS number,name,date_created

                                                 FROM tb_audit_region')->all();

I wonder why field “number” didn’t come up ?

Any solution ?

Hi j4v4, welcome to the forum.

Did you add "number" as a public varialble of the model?

http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#selecting-extra-fields