Skip to content

Commit

Permalink
TASK: add confirmation date of the subscription (psmb#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoldbeck authored and dimaip committed Nov 13, 2018
1 parent c60b832 commit 628771e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Classes/Psmb/Newsletter/Controller/SubscriptionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Psmb\Newsletter\Controller;

use Psmb\Newsletter\Domain\Model\Subscriber;
Expand Down Expand Up @@ -44,9 +45,9 @@ class SubscriptionController extends ActionController
protected $subscriberRepository;

/**
* @Flow\InjectConfiguration(path="subscriptions")
* @var string
*/
* @Flow\InjectConfiguration(path="subscriptions")
* @var string
*/
protected $subscriptions;

/**
Expand Down Expand Up @@ -116,8 +117,12 @@ public function registerAction(Subscriber $subscriber = null)
*/
public function confirmAction($hash)
{
/** @var Subscriber $subscriber */
$subscriber = $this->tokenCache->get($hash);
if ($subscriber) {
$metaData = $subscriber->getMetadata();
$metaData['confirmationDate'] = new \DateTime();
$subscriber->setMetadata($metaData);
$this->tokenCache->remove($hash);
$this->subscriberRepository->add($subscriber);
$this->persistenceManager->persistAll();
Expand Down

0 comments on commit 628771e

Please sign in to comment.