Commit fa0b2ceb authored by mabolek's avatar mabolek Committed by Thomas Löffler
Browse files

[WIP] Building signal slot implementation

parent 48b8738f
......@@ -33,3 +33,13 @@ defined('TYPO3_MODE') or die('Access denied.');
'UserDisplay' => '',
]
);
//Add karma to users when they are created
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = t3lib_div::makeInstance('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
$signalSlotDispatcher->connect(
\In2code\Femanager\Controller\AbstractController::class,
'finalCreateAfterPersist',
\T3o\Karma\Utility\UserProfileChangeKarmaIssuer::class,
'newUserWasCreated'
);
<?php
namespace T3o\Karma\Utility;
use In2code\Femanager\Controller\AbstractController as In2CodeAbstractController;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser as ExtbaseFrontendUser;
use T3o\Karma\Domain\Repository\KarmaSourceRepository;
use T3o\Karma\Service\KarmaService;
use T3o\Karma\Domain\Repository\FrontendUserRepository;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class UserProfileChangeKarmaIssuer
{
/**
* @var \T3o\Karma\Domain\Repository\KarmaService
*/
protected $karmaService;
/**
* @var \T3o\Karma\Domain\Repository\FrontendUserRepository
*/
protected $frontendUserRepository;
/**
* @var \T3o\Karma\Domain\Repository\KarmaSourceRepository
*/
protected $karmaSourceRepository;
/**
* @param \T3o\Karma\Domain\Repository\KarmaService $karmaService
*/
public function injectKarmaService(KarmaService $karmaService)
{
$this->karmaService = $karmaService;
}
/**
* @param \T3o\Karma\Domain\Repository\FrontendUserRepository $frontendUserRepository
*/
public function injectFrontendUserRepository(FrontendUserRepository $frontendUserRepository)
{
$this->frontendUserRepository = $frontendUserRepository;
}
/**
* @param \T3o\Karma\Domain\Repository\KarmaSourceRepository $karmaSourceRepository
*/
public function injectKarmaSourceRepository(KarmaSourceRepository $karmaSourceRepository)
{
$this->karmaSourceRepository = $karmaSourceRepository;
}
/**
* @param ExtbaseFrontendUser $frontendUser
* @param string $action
* @param In2CodeAbstractController $object
*/
public function newUserWasCreated(ExtbaseFrontendUser $frontendUser, string $action, In2CodeAbstractController $object)
{
$frontendUser = $this->frontendUserRepository->findByUid($frontendUser->getUid());
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment