"You're trying to register a file after View::endPage() has been called"

I getting an error

You’re trying to register a file after View::endPage() has been called

and it is flagging the line

'modelsDriversCertifications' => (empty($modelsDriversCertifications)) ? [new EmployeesDriversCertifications] : $modelsDriversCertifications

from

            return $this->renderAjax('update', [
                'model' => $model,
                'modelsDrivers' => (empty($modelsDrivers)) ? [new EmployeesDrivers] : $modelsDrivers,
                'modelsDriversServices' => (empty($modelsDriversServices)) ? [new EmployeesDriversServices] : $modelsDriversServices,
                'modelsDriversCertifications' => (empty($modelsDriversCertifications)) ? [new EmployeesDriversCertifications] : $modelsDriversCertifications
            ]);

and am at a lost on how to troubleshoot this?

Can you post your full controller action?
Also if there is anything relevant in view, post it!

I identified the issue, it all relates back to my issue with MSSQL RowVersion (RV). I deleted the RV column and the error goes away. I add it back and the error shows up.

I’m obviously not implementing the RV properly in Yii, or there’s a bug with Yii’s handling of things.

I just wish there was documentation on RV, concrete examples, but I haven’t found much of any.

I’ll keep digging. Hopefully I’ll eventually find something that works.

1 Like

I would start by investigating what the RV actually does to cause such error.
Or even better find a way to easily replace RV functionality with ordinary column!
Or if not trivial, replace MSSQL with a better database like Postgresql

Sadly I can’t

The db is set by the client. I have no control on the choice of dbs and can’t switch. (I can modify the tables/structure, but that’s it)
There is no replacing the functionality in this instance as the RowVersion column is required to be able to build Power Automate Flows off of the table. Furthermore, RowVersion columns are commonplace in MSSQL, so it truly is something Yii should handle.

Thank you for all your help. I truly appreciate it.

Sorry!
But you can still get some insights from issues that Yii has when dealing with RowVersion

Oh I’ve searched high and low, come across 4-5 posts/threads, but no solution.

Even rewriting the save method as an INSERT SQL statement generates the error above. No, this truly is a Yii feature support issue I believe. With Azure becoming more and more popular, this should be a priority to resolve IMHO.

I hope you find a solution. May be you move and ask in the live chat?