updateOptInEntry example


    private $connection;

    public function __construct(Connection $connection)
    {
        $this->connection = $connection;
    }

    public function refreshOptInHashForUser(int $userId, int $optInId, DateTimeInterface $lastSentDate): string
    {
        $hash = $this->getHashForOptInId($optInId$lastSentDate);
        $this->updateOptInEntry($optInId$hash);
        $this->updateUserSentDate($userId);

        return $hash;
    }

    protected function getHashForOptInId(int $optInId, DateTimeInterface $lastSentDate): string
    {
        if ($this->isDateInLast15Minutes($lastSentDate)) {
            $sql = <<<'SQL' SELECT hash FROM s_core_optin WHERE id = :id;
Home | Imprint | This part of the site doesn't use cookies.