Trouble with behavior [Solved with extension update]

I’m trying to implement an extension that uses behaviors (which I am new to). The extension uploads, crops, and saves an image. I am able to upload an image and use the cropper tool, but the image doesn’t save. $image->save() triggers the EVENT_BEFORE_UPDATE event, which calls the upload method. However, the if statement fails because $this->attribute is empty. Why isn’t the model populating the behavior object?




# model


    public function behaviors()

    {   

        return [

            'image' => [

                'class' => CutterBehavior::className(),

                'attributes' => 'imagefile',

                'baseDir' => '/uploads/image',

                'basePath' => '@webroot',

            ],

        ];

    }






#vendor/sadovojav/yii2-image-cutter/behaviors/CutterBehavior.php


class CutterBehavior extends \yii\behaviors\AttributeBehavior

{

    public function events()

    {

        return [

            ActiveRecord::EVENT_BEFORE_INSERT => 'upload',

            ActiveRecord::EVENT_BEFORE_UPDATE => 'upload',

            ActiveRecord::EVENT_BEFORE_DELETE => 'delete',

        ];

    }


    public function upload()

    {

        if ($uploadImage = UploadedFile::getInstance($this->owner, $this->attribute)) {

            .

            .

            .






# view


<?= $form->field($image, 'imagefile')->widget(\sadovojav\cutter\Cutter::className(), [

    //options

]); ?>



Problem solved. This ended up being an issue with the extension which was fixed with a later release than the one I installed from Packagist.