Using The Event Notification System With The Api?

Hi, I'm trying to extend the functionality of the API for 'Reset Password' similar to what the normal CS-Cart system does. But I get an error whenever I put

 $event_dispatcher = Tygh::$app['event.dispatcher'];

The error being:

Class 'Tygh\Api\Entities\Tygh' not found

Does this mean I can't use the event system through the API? If I can and I'm just doing something wrong, how do I solve this problem?

Try using:

$event_dispatcher = \Tygh::$app['event.dispatcher'];

It worked! Thank you so much! Could I use the mailer in the same way?


$mailer = \Tygh::$app['mailer']

You only need to escape the class when it is nested inside another file that has a 'use' clause that conflicts with the base classes. So if you find that it's looking for the Tygh class inside of another class, use the escape.

Noted, thank you very much!