Skip to content

Commit

Permalink
Merge pull request lochmueller#397 from svewap/master
Browse files Browse the repository at this point in the history
TYPO3 10 compatibility
  • Loading branch information
lochmueller authored Jun 10, 2020
2 parents c38f182 + 7e21814 commit f68a327
Show file tree
Hide file tree
Showing 45 changed files with 391 additions and 194 deletions.
4 changes: 2 additions & 2 deletions Classes/Command/AbstractCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

namespace HDNET\Calendarize\Command;

use Symfony\Component\Console\Command\Command;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;

/**
* Command controller abstraction.
*/
abstract class AbstractCommandController extends CommandController
abstract class AbstractCommandController extends Command
{
/**
* Flash message service.
Expand Down
4 changes: 2 additions & 2 deletions Classes/Command/CleanupCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function runCommand(
$waitingPeriod = self::DEFAULT_WAIT_PERIOD
) {
/** @var EventRepository $repository */
$repository = HelperUtility::create($repositoryName);
$repository = GeneralUtility::makeInstance($repositoryName);

if (!($repository instanceof EventRepository)) {
return;
Expand Down Expand Up @@ -196,7 +196,7 @@ protected function findOutdatedEvents($tableName, $waitingPeriod): array
*/
protected function reIndex()
{
$indexer = $this->objectManager->get(IndexerService::class);
$indexer = GeneralUtility::makeInstance(IndexerService::class);
$indexer->reindexAll();
}
}
34 changes: 30 additions & 4 deletions Classes/Command/ReindexCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,44 @@
namespace HDNET\Calendarize\Command;

use HDNET\Calendarize\Service\IndexerService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
use TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException;
use TYPO3\CMS\Extbase\Object\Exception;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;

/**
* Reindex the event models.
*/
class ReindexCommandController extends AbstractCommandController
class ReindexCommandController extends Command
{

/**
* Run the reindex process.
* @return void
*/
public function runCommand()
public function configure()
{
$indexer = $this->objectManager->get(IndexerService::class);
$this->setDescription('Calendarize: Reindex all events');
}

/**
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
* @throws InvalidConfigurationTypeException
* @throws InvalidExtensionNameException
* @throws Exception
* @throws InvalidQueryException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$indexer = GeneralUtility::makeInstance(IndexerService::class);
$indexer->reindexAll();

return 0;
}
}
12 changes: 4 additions & 8 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config

$this->settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);

$objectManager = new ObjectManager();
$pluginConfigurationService = $objectManager->get(PluginConfigurationService::class);
$pluginConfigurationService = GeneralUtility::makeInstance(PluginConfigurationService::class);
$this->settings = $pluginConfigurationService->respectPluginConfiguration((array)$this->settings);
}

Expand Down Expand Up @@ -170,11 +169,8 @@ protected function calculatePluginHmac()
{
$string = $this->getStringForPluginHmac();

/** @var HashService $hashService */
$hashService = HelperUtility::create(HashService::class);
$hmac = $hashService->generateHmac($string);

return $hmac;
$hashService = GeneralUtility::makeInstance(HashService::class);
return $hashService->generateHmac($string);
}

/**
Expand All @@ -189,7 +185,7 @@ protected function validatePluginHmac(string $hmac): bool
$string = $this->getStringForPluginHmac();

/** @var HashService $hashService */
$hashService = HelperUtility::create(HashService::class);
$hashService = GeneralUtility::makeInstance(HashService::class);

return $hashService->validateHmac($string, $hmac);
}
Expand Down
24 changes: 12 additions & 12 deletions Classes/Controller/CalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public function initializeAction()
* @param int $month
* @param int $week
*
* @ignorevalidation $startDate
* @ignorevalidation $endDate
* @ignorevalidation $customSearch
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $startDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $endDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $customSearch
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
Expand Down Expand Up @@ -152,9 +152,9 @@ public function latestAction(
* @param int $month
* @param int $week
*
* @ignorevalidation $startDate
* @ignorevalidation $endDate
* @ignorevalidation $customSearch
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $startDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $endDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $customSearch
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
Expand Down Expand Up @@ -202,9 +202,9 @@ public function resultAction(
* @param int $day
* @param int $week
*
* @ignorevalidation $startDate
* @ignorevalidation $endDate
* @ignorevalidation $customSearch
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $startDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $endDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $customSearch
*
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
Expand Down Expand Up @@ -468,9 +468,9 @@ public function detailAction(Index $index = null)
* @param \DateTime $endDate
* @param array $customSearch
*
* @ignorevalidation $startDate
* @ignorevalidation $endDate
* @ignorevalidation $customSearch
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $startDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $endDate
* @TYPO3\CMS\Extbase\Annotation\IgnoreValidation $customSearch
*/
public function searchAction(\DateTime $startDate = null, \DateTime $endDate = null, array $customSearch = [])
{
Expand Down
53 changes: 28 additions & 25 deletions Classes/Domain/Model/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,110 +7,113 @@

namespace HDNET\Calendarize\Domain\Model;


use HDNET\Autoloader\Annotation\DatabaseField;
use HDNET\Autoloader\Annotation\DatabaseTable;
use HDNET\Autoloader\Annotation\SmartExclude;
use HDNET\Calendarize\Utility\DateTimeUtility;

/**
* Configuration for time options.
*
* @db
* @smartExclude Language
* @DatabaseTable
* @SmartExclude("Language")
*/
class Configuration extends AbstractModel implements ConfigurationInterface
{
/**
* Type.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $type = self::TYPE_TIME;

/**
* Handling.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $handling = self::HANDLING_INCLUDE;

/**
* State.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $state = self::STATE_DEFAULT;

/**
* Start date.
*
* @var \DateTime
* @db date default NULL
* @DatabaseField(type="\DateTime",sql="date default NULL")
*/
protected $startDate;

/**
* End date.
*
* @var \DateTime
* @db date default NULL
* @DatabaseField(type="\DateTime",sql="date default NULL")
*/
protected $endDate;

/**
* End date dynamic.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $endDateDynamic;

/**
* Start time.
*
* @var int
* @db
* @DatabaseField("int")
*/
protected $startTime;

/**
* End time.
*
* @var int
* @db
* @DatabaseField("int")
*/
protected $endTime;

/**
* AllDay.
*
* @var bool
* @db
* @DatabaseField("bool")
*/
protected $allDay;

/**
* OpenEndTime.
*
* @var bool
* @db
* @DatabaseField("bool")
*/
protected $openEndTime;

/**
* External ICS url.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $externalIcsUrl;

/**
* Groups.
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\HDNET\Calendarize\Domain\Model\ConfigurationGroup>
* @db text
* @lazy
* @DatabaseField("\TYPO3\CMS\Extbase\Persistence\ObjectStorage")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $groups;
Expand All @@ -119,79 +122,79 @@ class Configuration extends AbstractModel implements ConfigurationInterface
* Frequency.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $frequency = self::FREQUENCY_NONE;

/**
* Till date.
*
* @var \DateTime
* @db
* @DatabaseField("\DateTime")
*/
protected $tillDate;

/**
* Till days.
*
* @var int
* @db int(11)
* @DatabaseField(sql="int(11)")
*/
protected $tillDays;

/**
* Till days relative.
*
* @var bool
* @db tinyint(4) unsigned
* @DatabaseField(sql="tinyint(4) unsigned")
*/
protected $tillDaysRelative;

/**
* Till days past.
*
* @var int
* @db int(11)
* @DatabaseField(sql="int(11)")
*/
protected $tillDaysPast;

/**
* Counter amount.
*
* @var int
* @db
* @DatabaseField("int")
*/
protected $counterAmount;

/**
* Counter interval.
*
* @var int
* @db
* @DatabaseField("int")
*/
protected $counterInterval;

/**
* Recurrence.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $recurrence = self::RECURRENCE_NONE;

/**
* Day property.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $day = self::DAY_NONE;

/**
* Import ID if the item is based on an ICS structure.
*
* @var string
* @db
* @DatabaseField("string")
*/
protected $importId;

Expand Down
Loading

0 comments on commit f68a327

Please sign in to comment.