Skip to content

Commit

Permalink
[TASK] Upgrade to work with TYPO3 11
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Jan 25, 2022
1 parent 39f7634 commit 5de1fdc
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Classes/Command/CountryNameMigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class CountryNameMigrationCommand extends Command
/**
* @inheritdoc
*/
protected function configure()
protected function configure(): void
{
$this->setDescription('Migrate tt_address country field');
}

/**
* @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): void
{
$service = GeneralUtility::makeInstance(MigrationService::class);
$count = $service->run();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?php

namespace StudioMitte\TtaddressCountryRelation\Domain\Model;
declare(strict_types=1);

namespace StudioMitte\TtaddressCountryRelation\Extending\Domain\Model;

class Address extends \FriendsOfTYPO3\TtAddress\Domain\Model\Address
{

/**
* @var \SJBR\StaticInfoTables\Domain\Model\Country
*/
protected $countryRelation = null;
protected $countryRelation;

/**
* @var \SJBR\StaticInfoTables\Domain\Model\CountryZone
*/
protected $regionRelation = null;
protected $regionRelation;

/**
* @return \SJBR\StaticInfoTables\Domain\Model\Country
Expand Down
10 changes: 5 additions & 5 deletions Classes/Migration/MigrationService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace StudioMitte\TtaddressCountryRelation\Migration;
Expand All @@ -8,7 +9,6 @@

class MigrationService
{

public function run(): int
{
$count = 0;
Expand All @@ -20,7 +20,7 @@ public function run(): int
->where(
$queryBuilder->expr()->eq('country_relation', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
$queryBuilder->expr()->neq('country', $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)),
)
)
->execute()
->fetchAll();
foreach ($rows as $row) {
Expand All @@ -43,10 +43,10 @@ protected function updateSingleRow(string $countryName, int $addressUid): bool
$connection->update(
'tt_address',
[
'country_relation' => $staticCountryId
'country_relation' => $staticCountryId,
],
[
'uid' => $addressUid
'uid' => $addressUid,
]
);

Expand Down Expand Up @@ -78,4 +78,4 @@ protected function getStaticCountryRow(string $countryName): int

return 0;
}
}
}
2 changes: 2 additions & 0 deletions Configuration/Commands.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

declare(strict_types=1);
/**
* Commands to be executed by typo3, where the key of the array
* is the name of the command (to be called as the first argument after typo3).
Expand Down
24 changes: 13 additions & 11 deletions Configuration/TCA/Overrides/tt_address.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);
defined('TYPO3_MODE') || die('Access denied.');

call_user_func(
function ($extKey) {
function ($extKey): void {
$fields = [
'country_relation' => [
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.country',
Expand All @@ -18,16 +20,16 @@ function ($extKey) {
'suggestOptions' => [
'default' => [
'pidList' => '0',
'additionalSearchFields' => 'cn_short_de'
]
'additionalSearchFields' => 'cn_short_de',
],
],
'fieldWizard' => [
'recordsOverview' => [
'disabled' => true
'disabled' => true,
],
'tableList' => [
'disabled' => true
]
'disabled' => true,
],
],
],
],
Expand All @@ -45,16 +47,16 @@ function ($extKey) {
'suggestOptions' => [
'default' => [
'pidList' => '0',
'additionalSearchFields' => 'zn_name_local'
]
'additionalSearchFields' => 'zn_name_local',
],
],
'fieldWizard' => [
'recordsOverview' => [
'disabled' => true
'disabled' => true,
],
'tableList' => [
'disabled' => true
]
'disabled' => true,
],
],
],
],
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
],
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "^9.5 || ^10.0",
"php": ">=7.2",
"friendsoftypo3/tt-address": "^5",
"evoweb/extender": "^6 || ^7",
"sjbr/static-info-tables": "^6"
"typo3/cms-core": "^11.0",
"php": ">=7.4",
"friendsoftypo3/tt-address": "^5.3",
"evoweb/extender": "^8.1",
"sjbr/static-info-tables": "^11.5"
},
"extra": {
"typo3/cms": {
Expand Down
12 changes: 7 additions & 5 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$EM_CONF[$_EXTKEY] = [
'title' => 'Country relation for tt_address',
'description' => 'Use a relation to static_info_tables for the country field',
Expand All @@ -8,13 +10,13 @@
'clearCacheOnLoad' => true,
'author' => 'Georg Ringer',
'author_email' => 'gr@studiomitte.com',
'version' => '1.0.0',
'version' => '2.0.0',
'constraints' => [
'depends' => [
'typo3' => '9.5.9-9.5.99',
'tt_address' => '5.0.0-6.9.99',
'static_info_tables' => '6.7.5-6.9.99',
'extender' => '6.6.1-6.6.99',
'typo3' => '11.5.0-11.5.99',
'tt_address' => '5.3.0-5.3.99',
'static_info_tables' => '11.5.1-11.5.99',
'extender' => '8.1.0-8.9.99',
],
'conflicts' => [
],
Expand Down
11 changes: 7 additions & 4 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

declare(strict_types=1);
defined('TYPO3_MODE') || die('Access denied.');

call_user_func(
function ($extKey) {

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extender'][\FriendsOfTYPO3\TtAddress\Domain\Model\Address::class][$extKey]
= 'EXT:ttaddress_country_relation/Classes/Domain/Model/Address.php';
static function ($extKey): void {
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['tt_address']['extender'][
\FriendsOfTYPO3\TtAddress\Domain\Model\Address::class
][$extKey] = 'EXT:'. $extKey . '/Classes/Extending/Domain/Model/Address.php';
// $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$extKey]['extender'][\FriendsOfTYPO3\TtAddress\Domain\Model\Address::class][$extKey] = 'Domain/Model/Address';
},
'ttaddress_country_relation'
);

0 comments on commit 5de1fdc

Please sign in to comment.