<?php namespace domain\User\UserProducer\Event; use justcoded\yii2\eventlistener\observers\ActiveRecordObserver; use domain\User\UserProducer\UserProducerModule; use yii\db\AfterSaveEvent; class PaymentObserver extends ActiveRecordObserver { public function inserted(AfterSaveEvent $event) { $payment = $event->sender; $userProducerModule = UserProducerModule::getInstance(); $userProducerModule->updateCredit($payment); } }