Shahid Thaika Shahid Thaika - 1 year ago 209
PHP Question

Yii2 - Code broke after composer update (Dektrium Yii2-User Profile)

Today I did a composer update on my Yii2 project. During that time, Yii upgraded from 2.0.8 to 2.0.9. The following extensions I was using also upgraded...

- Removing dektrium/yii2-user (0.9.6)
- Installing dektrium/yii2-user (dev-master d9530a1)
Cloning d9530a1b4213c2bd7fd8eb05d185dfe9dffde558

- Updating dektrium/yii2-rbac dev-master (4254915 => 0943e
Checking out 0943e66c450132b306584a37caefc2aa04258372

Once the updates happened, I was unable to save (update) my User's Profile records. I rechecked the deployment server and it works there.

I used the "$model->getErrors()" function to see what error I get, and it said...

Time zone is not valid

I am not sure what the Time zone has to do with the User record, or the associate Profile record in Yii2. I have reached out to the extension developer, but any suggestions while I wait for his reply would be appreciated.

I tried setting it in the formatter section of web.php config file, as below...

'defaultTimeZone' => 'America/Los_Angeles',

My php.ini file has...

date.timezone = UTC

I even tried deleting and adding a new user, but no joy.

I am totally stumped, and not sure what else to do.

Answer Source

This is a validation of Profile->timezone attribute. As you can see here.

In your table, you must have the timezone column and it's value must be a valid timezone