Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
coverage: none
tools: composer:v2
env:
Expand All @@ -29,9 +29,7 @@ jobs:
strategy:
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.3
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
249 changes: 109 additions & 140 deletions Classes/Controller/FrontendUserController.php

Large diffs are not rendered by default.

155 changes: 88 additions & 67 deletions Classes/Domain/Model/FrontendUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace Visol\Newsletterregistration\Domain\Model;

use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

/**
* This file is part of the TYPO3 CMS project.
*
Expand All @@ -19,118 +21,137 @@
*/
/**
* A Frontend User
*
* @api
*/
class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
class FrontendUser extends AbstractEntity
{

/**
* @var ObjectStorage<FrontendUserGroup>
*/
protected $usergroup = null;
protected $usergroup;

/**
* @var string
*/
protected $gender;
protected string $gender;

/**
* @var boolean
*/
protected $activateNewsletter;
protected bool $activateNewsletter;

/**
* @var boolean
*/
protected $receiveHtmlMail;
protected bool $receiveHtmlMail;

/**
* @var boolean
*/
protected $disable;
protected bool $disable;

/**
* @var string
* @Extbase\Validate("EmailAddress")
* @Extbase\Validate("NotEmpty")
*/
protected $email;
#[Extbase\Validate(['validator' => 'EmailAddress'])]
#[Extbase\Validate(['validator' => 'NotEmpty'])]
protected string $email;

/**
* Constructs a new Front-End User
*
* @api
* @param string $username
* @param string $password
*/
public function __construct($username = '', $password = '')
public function __construct(
protected string $username = '',
protected string $password = '',
protected string $firstName = '',
protected string $lastName = '',
) {
}

public function setUsername(string $username): void
{
parent::__construct($username, $password);
$this->username = $username;
}

/**
* @return string
*/
public function getGender()
public function getUsername(): string
{
return $this->username;
}

public function setPassword(string $password): void
{
$this->password = $password;
}

public function getPassword(): string
{
return $this->password;
}

public function getGender(): string
{
return $this->gender;
}

/**
* @param string $gender
*/
public function setGender($gender)
public function setGender(string $gender): void
{
$this->gender = $gender;
}

/**
* @return boolean
*/
public function isActivateNewsletter()
public function isActivateNewsletter(): bool
{
return $this->activateNewsletter;
}

/**
* @param boolean $activateNewsletter
*/
public function setActivateNewsletter($activateNewsletter)
public function setActivateNewsletter(bool $activateNewsletter): void
{
$this->activateNewsletter = $activateNewsletter;
}

/**
* @return boolean
*/
public function isReceiveHtmlMail()
public function isReceiveHtmlMail(): bool
{
return $this->receiveHtmlMail;
}

/**
* @param boolean $receiveHtmlMail
*/
public function setReceiveHtmlMail($receiveHtmlMail)
public function setReceiveHtmlMail(bool $receiveHtmlMail): void
{
$this->receiveHtmlMail = $receiveHtmlMail;
}

public function isDisable(): bool
{
return $this->disable;
}

public function setDisable(bool $disable): void
{
$this->disable = $disable;
}

public function getEmail(): string
{
return $this->email;
}

public function setEmail(string $email): void
{
$this->email = $email;
}

/**
* @return boolean
* @return ObjectStorage<FrontendUserGroup>
*/
public function isDisable()
public function getUsergroup(): ?ObjectStorage
{
return $this->disable;
return $this->usergroup;
}

/**
* @param boolean $disable
* @param ObjectStorage<FrontendUserGroup> $usergroup
*/
public function setDisable($disable)
public function setUsergroup(ObjectStorage $usergroup): void
{
$this->disable = $disable;
$this->usergroup = $usergroup;
}

public function getFirstName(): string
{
return $this->firstName;
}

public function setFirstName(string $firstName): void
{
$this->firstName = $firstName;
}

public function getLastName(): string
{
return $this->lastName;
}

public function setLastName(string $lastName): void
{
$this->lastName = $lastName;
}
}
9 changes: 4 additions & 5 deletions Classes/Domain/Repository/FrontendUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;
use Visol\Newsletterregistration\Domain\Model\FrontendUser;

/**
* This file is part of the TYPO3 CMS project.
*
Expand All @@ -20,8 +21,7 @@
*/
class FrontendUserRepository extends Repository
{

public function initializeObject()
public function initializeObject(): void
{
$querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
Expand All @@ -30,8 +30,8 @@ public function initializeObject()

/**
* @param string $email
* @param integer $targetFolder
* @return FrontendUser|NULL
* @param int $targetFolder
* @return FrontendUser|null
*/
public function findOneByEmailAndStoragePageId($email, $targetFolder)
{
Expand Down Expand Up @@ -65,5 +65,4 @@ public function findByUid($uid, bool $respectEnableFields = true): ?FrontendUser
)
)->execute()->getFirst();
}

}
41 changes: 41 additions & 0 deletions Classes/Updates/VisolNewsletterregistrationCTypeMigration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Visol\Newsletterregistration\Updates;

use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate;

#[UpgradeWizard('visolNewsletterregistrationCTypeMigration')]
final class VisolNewsletterregistrationCTypeMigration extends AbstractListTypeToCTypeUpdate
{
public function getTitle(): string
{
return 'Migrate "Visol Newsletterregistration" plugins to content elements.';
}

public function getDescription(): string
{
return 'The "Visol Newsletterregistration" plugins are now registered as content element. Update migrates existing records and backend user permissions.';
}

/**
* This must return an array containing the "list_type" to "CType" mapping
*
* Example:
*
* [
* 'pi_plugin1' => 'pi_plugin1',
* 'pi_plugin2' => 'new_content_element',
* ]
*
* @return array<string, string>
*/
protected function getListTypeToCTypeMapping(): array
{
return [
// TODO: Add this mapping yourself!
];
}
}
6 changes: 3 additions & 3 deletions Configuration/Extbase/Persistence/Classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
'tableName' => 'fe_users',
'properties' => [
'activateNewsletter' => [
'fieldName' => 'module_sys_dmail_newsletter'
'fieldName' => 'module_sys_dmail_newsletter',
],
'receiveHtmlMail' => [
'fieldName' => 'module_sys_dmail_html'
'fieldName' => 'module_sys_dmail_html',
],
]
],
],
];
Loading