<?php

namespace KupShop\ReclamationsElninoBundle\Email;

use KupShop\ReclamationsBundle\Entity\ReclamationEntity;

class ReclamationEmail extends \KupShop\ReclamationsBundle\Email\ReclamationEmail
{
    protected static $priority = 0;

    /** @var ReclamationEntity */
    protected $reclamation;
    protected $comment;

    private $logHistory = false;

    public function testEmail(): array
    {
        if (!isset($this->reclamation)) {
            $data = sqlQuery('select id, code, package_id, bank_account, descr, data from reclamations_elnino limit 1')->fetch();
            if ($data !== false) {
                $this->reclamation = new ReclamationEntity();
                $this->reclamation->setCode($data['code']);
                $this->reclamation->setId($data['id']);
                $this->reclamation->setPackageId($data['package_id']);
                $this->reclamation->setBankAccount($data['bank_account']);
                $this->reclamation->setDescr($data['descr']);
                $this->reclamation->setData($data['data']);
            }
        }

        return parent::testEmail();
    }
}
