Example #1
0
 /**
  * @inheritDoc
  */
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         $this->trigger(self::EVENT_STATUS_CHANGED, new RequestStatusChangedEvent(['request' => $this]));
         foreach ($this->participants as $participant) {
             if ($participant->ahuConfirmation) {
                 $roomStatus = Participant::STATUS_CONSIDIRATION;
                 $participant->trigger(Participant::EVENT_STATUS_CHANGED, new RoomStatusChangedEvent(['request' => $this, 'roomStatus' => $roomStatus]));
             } else {
                 $roomStatus = Participant::STATUS_APPROVE;
             }
             $participant->writeLog($this, $roomStatus, true);
         }
     }
 }