ReflectionException - Class yii\i18n\formatter does not exist

Hi,

I am uploading my Yii project on my web server. This project works fine on my local XAMPP server, but when I upload online and try, it is failing with an error:

[b]ReflectionException

Class yii\i18n\formatter does not exist[/b]

The highlighted code in the error is:


$reflection = new ReflectionClass($class);

My view file is:




<?php


use yii\helpers\Html;

use kartik\grid\GridView;

use yii\db\Expression;


/* @var $this yii\web\View */

/* @var $dataProvider yii\data\ActiveDataProvider */


$this->title = 'Tenancies';

$this->params['breadcrumbs'][] = $this->title;

?>

<div class="tenancy-index">


    <h1><?= Html::encode($this->title) ?></h1>


    <p>

        <?= Html::a('<i class="glyphicon glyphicon-plus"></i> Create Tenancy', ['create'], ['class' => 'btn btn-success']) ?>

    </p>

    


    

    <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'responsive' =>true,

        'rowOptions'=>function($model){

                    $now = Yii::$app->formatter->asDate(date('Y-m-d'));

                    $endDate = date_create($model->end_date);

                    $todayDate = date_create($now);

                         

                    $diff = date_diff($todayDate, $endDate);


                    if($diff->days <= 60)

                    {

                        return ['class'=>'danger'];

                    }


            },

        'hover'=>true,

        'columns' => [

            ['class' => '\kartik\grid\SerialColumn'],


            'customer.name:text:Customer Name',

            'property.name:text:Property Name',

            

            [

              'label' => 'Start Date',

              'format' => 'Date',

              'attribute' => 'start_date',

            ],

            [

              'label' => 'End Date',

              'format' => 'Date',

              'attribute' => 'end_date',

            ],

            [

              'label' => 'Rent',

              'format' => 'Currency',

              'attribute' => 'rent',

            ],

            // 'cheques',

            // 'old_tenancy',

            // 'active',

            // 'rent',


            ['class' => '\kartik\grid\ActionColumn'],

        ],

    ]); ?>


</div>



Any assistance would be much appreciated.

OK. I found the solution for this. ‘Formatter’ was spelt with a small ‘f’. Replaced and it worked:


 'formatter' => [

            'class' => 'yii\i18n\[b]F[/b]ormatter',

            'thousandSeparator' => ',',

            'decimalSeparator' => '.',

            'currencyCode' => 'QAR'

        ],



Thank you, really I just replaced the “f” by an “F” from the “Formatter” in config/web.php and solved the problem. ;)