Error with new Behaviour

Hello community,

I just follow the howTo for a new behaviour on a class extended of ActiveRecord.
Here the Behaviour class in “common\components” directory:

<?php
namespace app\components;

use yii\base\Behavior;
use yii\db\BaseActiveRecord;

class i18nBehavior extends Behavior
{
    public function events(): array
    {
        return [
            BaseActiveRecord::EVENT_AFTER_FIND => 'translate',
        ];
    }

    public function translate($event): void
    {
// Do something
    }
}

and here the attach in the class:

    public function behaviors(): array
    {
        return [['class' => i18nBehavior::class]];
    }

but I’m getting this error when running:

Not instantiable – yii\di\NotInstantiableException
Failed to instantiate component or class "app\components\i18nBehavior".
↵
Caused by: ReflectionException
Class "app\components\i18nBehavior" does not exist
in /app/vendor/yiisoft/yii2/di/Container.php at line 507

I can’t find why?
Thank you.

Are you sure that file with class definition have correct name (i18nBehavior.php - name is case-sensitive)?

Yes, all case are OK.

Found out that this was the issue: namespace app\components;
Should be: namespace common\components;

Thank you.