diff options
author | marcinzelent <zelent.marcin@gmail.com> | 2017-12-01 11:06:29 +0100 |
---|---|---|
committer | marcinzelent <zelent.marcin@gmail.com> | 2017-12-01 11:06:29 +0100 |
commit | 7d09b3a6201a175128421d117d4c63495813fa05 (patch) | |
tree | e014a83d47801ea13ce5ee9259082dde0fe43ce0 /src/AppBundle/Controller/NewDataController.php | |
parent | 491eb42cd125b76f96d4f906c3822202d55395a1 (diff) |
Refactored sending of e-mails and made it work.
Diffstat (limited to 'src/AppBundle/Controller/NewDataController.php')
-rw-r--r-- | src/AppBundle/Controller/NewDataController.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/AppBundle/Controller/NewDataController.php b/src/AppBundle/Controller/NewDataController.php index f63a7fa..9722cbd 100644 --- a/src/AppBundle/Controller/NewDataController.php +++ b/src/AppBundle/Controller/NewDataController.php @@ -11,6 +11,8 @@ namespace AppBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use AppBundle\Utils\Aqi; +use AppBundle\Utils\EmailSender; class NewDataController extends Controller { @@ -18,7 +20,7 @@ class NewDataController extends Controller * @Route("/latest") */ - public function getLatestData() + public function getLatestData(Aqi $aqi, EmailSender $emailSender) { // Get cURL resource $curl = curl_init(); @@ -37,6 +39,9 @@ class NewDataController extends Controller $response = new Response($data); $response->headers->set('Content-Type', 'application/json'); + $data = json_decode($resp, true); + if($aqi >= 151) $emailSender->sendEmail($data); + return $response; } |