protected static function resolveReadOnlyAndSetValueToAttribute(RedBeanModel $model, $attributeName, $value) { assert('is_string($attributeName)'); if (!$model->isAttributeReadOnly($attributeName) || $model->isAttributeReadOnly($attributeName) && $model->isAllowedToSetReadOnlyAttribute($attributeName)) { $model->{$attributeName} = $value; } }