protected function makeMessage(Date $date, $place, $amount)
 {
     $body = file_get_contents(__DIR__ . '/stubs/itaucard_message.mock');
     $body = str_replace('{{date}}', $date->format('d-m-Y'), $body);
     $body = str_replace('{{place}}', $place, $body);
     $body = str_replace('{{amount}}', 'R$ ' . $amount, $body);
     $message = new Swift_Message('Últimas transações realizadas com o cartão', $body, 'text/html', 'utf-8');
     return $message;
 }
 /**
  * @param \ebussola\common\datatype\datetime\Date $date
  * @param $place
  * @param $amount
  * @return Swift_Message
  */
 protected function makeMessage(\ebussola\common\datatype\datetime\Date $date, $place, $amount)
 {
     $body = file_get_contents(__DIR__ . '/stubs/itau_debt_message.mock');
     $body = str_replace('{{date}}', $date->format('d/m/Y'), $body);
     $body = str_replace('{{place}}', $place, $body);
     $body = str_replace('{{amount}}', 'R$ ' . $amount, $body);
     $message = new Swift_Message('Compra com cartão débito aprovada', $body, 'text/html', 'utf-8');
     return $message;
 }
 /**
  * @param \ebussola\common\datatype\datetime\Date $date
  * @param $place
  * @param $amount
  * @return Swift_Message
  */
 protected function makeMessage(\ebussola\common\datatype\datetime\Date $date, $place, $amount)
 {
     $body = file_get_contents(__DIR__ . '/stubs/itau_withdraw_message.mock');
     $body = str_replace('{{date}}', $date->format('d/m/Y'), $body);
     $body = str_replace('{{place}}', $place, $body);
     $body = str_replace('{{amount}}', 'R$ ' . $amount, $body);
     $message = new Swift_Message('Saque realizado', $body, 'text/html', 'utf-8');
     return $message;
 }
 /**
  * @param \ebussola\common\datatype\datetime\Date $date_start
  * @param \ebussola\common\datatype\datetime\Date $date_end
  * @param int $user_id
  * @return \shina\controlmybudget\PeriodGoal[]
  */
 public function findPeriodGoalsByPeriod($date_start, $date_end, $user_id)
 {
     $query = $this->conn->createQueryBuilder()->select('*')->from('period_goal', 'mg')->where('mg.date_start <= :date_end')->andWhere('mg.date_end >= :date_start')->andWhere('mg.user_id = :user_id');
     $data = $this->conn->executeQuery($query, array('date_start' => $date_start->format('Y-m-d'), 'date_end' => $date_end->format('Y-m-d'), 'user_id' => $user_id))->fetchAll();
     foreach ($data as &$period_goal_data) {
         $events_data = $this->conn->executeQuery('SELECT * FROM period_event WHERE period_goal_id = ?', array($period_goal_data['id']))->fetchAll();
         $period_goal_data['events'] = $events_data;
     }
     return $data;
 }