Commit 112c73f7 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

[!!!][RELEASE] Code changes to run in TYPO3 v10

parent 040faa20
<?php <?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Controller; namespace T3o\Typo3Roadmap\Controller;
/** /**
...@@ -15,16 +15,19 @@ namespace T3o\Typo3Roadmap\Controller; ...@@ -15,16 +15,19 @@ namespace T3o\Typo3Roadmap\Controller;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository;
use T3o\Typo3Roadmap\Domain\Repository\FeatureRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/** /**
* FeatureController * FeatureController
*/ */
class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController class FeatureController extends ActionController
{ {
/** /**
* featureRepository * featureRepository
* *
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureRepository * @var \T3o\Typo3Roadmap\Domain\Repository\FeatureRepository
* @inject
*/ */
protected $featureRepository = null; protected $featureRepository = null;
...@@ -32,19 +35,28 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -32,19 +35,28 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* featureAreaRepository * featureAreaRepository
* *
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository * @var \T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository
* @inject
*/ */
protected $featureAreaRepository = null; protected $featureAreaRepository = null;
public function injectFeatureRepository(FeatureRepository $featureRepository): void
{
$this->featureRepository = $featureRepository;
}
public function injectFeatureAreaRepository(FeatureAreaRepository $featureAreaRepository): void
{
$this->featureAreaRepository = $featureAreaRepository;
}
/** /**
* action listFeatures * action listFeatures
* *
* @return void * @return void
*/ */
public function listFeaturesAction() public function listFeaturesAction(): void
{ {
if ($this->settings['featurearea'] != '') { if ($this->settings['featurearea'] !== '') {
$featureArea = $this->featureAreaRepository->findByUid((int)$this->settings['featurearea']); $featureArea = $this->featureAreaRepository->findByUid((int)$this->settings['featurearea']);
$this->view->assign('featureArea', $featureArea); $this->view->assign('featureArea', $featureArea);
} }
...@@ -58,7 +70,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -58,7 +70,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* *
* @return void * @return void
*/ */
public function showFeatureRecordsAction() public function showFeatureRecordsAction(): void
{ {
$features = []; $features = [];
$ids = explode(',', $this->settings['feature']); $ids = explode(',', $this->settings['feature']);
...@@ -73,7 +85,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -73,7 +85,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* *
* @return void * @return void
*/ */
public function showFeatureAreaRecordsAction() public function showFeatureAreaRecordsAction(): void
{ {
$featureAreas = []; $featureAreas = [];
$ids = explode(',', $this->settings['featureArea']); $ids = explode(',', $this->settings['featureArea']);
...@@ -82,5 +94,4 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -82,5 +94,4 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
} }
$this->view->assign('featureAreas', $featureAreas); $this->view->assign('featureAreas', $featureAreas);
} }
} }
<?php <?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Controller; namespace T3o\Typo3Roadmap\Controller;
/** /**
...@@ -14,14 +15,17 @@ namespace T3o\Typo3Roadmap\Controller; ...@@ -14,14 +15,17 @@ namespace T3o\Typo3Roadmap\Controller;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use \TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use \T3o\Typo3Roadmap\Domain\Model\MajorVersion; use \T3o\Typo3Roadmap\Domain\Model\MajorVersion;
use T3o\Typo3Roadmap\Domain\Repository\MajorVersionRepository;
use T3o\Typo3Roadmap\Domain\Repository\PhpVersionRepository;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/** /**
* Class \T3o\Typo3Roadmap\Controller\RoadmapController * Class \T3o\Typo3Roadmap\Controller\RoadmapController
* @author Sebastian Diez * @author Sebastian Diez
*/ */
class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController class RoadmapController extends ActionController
{ {
/* /*
* Color Codes for the charts * Color Codes for the charts
...@@ -36,7 +40,6 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -36,7 +40,6 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* majorVersionRepository * majorVersionRepository
* *
* @var \T3o\Typo3Roadmap\Domain\Repository\MajorVersionRepository * @var \T3o\Typo3Roadmap\Domain\Repository\MajorVersionRepository
* @inject
*/ */
protected $majorVersionRepository = null; protected $majorVersionRepository = null;
...@@ -44,24 +47,25 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -44,24 +47,25 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* majorVersionRepository * majorVersionRepository
* *
* @var \T3o\Typo3Roadmap\Domain\Repository\PhpVersionRepository * @var \T3o\Typo3Roadmap\Domain\Repository\PhpVersionRepository
* @inject
*/ */
protected $phpVersionRepository = null; protected $phpVersionRepository = null;
/** public function injectMajorVersionRepository(MajorVersionRepository $majorVersionRepository): void
* pageRenderer {
* $this->majorVersionRepository = $majorVersionRepository;
* @var \TYPO3\CMS\Core\Page\PageRenderer }
* @inject
*/ public function injectPhpVersionRepository(PhpVersionRepository $phpVersionRepository): void
protected $pageRenderer = null; {
$this->phpVersionRepository = $phpVersionRepository;
}
/** /**
* action roadmap * action roadmap
* *
* @return void * @return void
*/ */
public function roadmapAction() public function roadmapAction(): void
{ {
$majorVersions = array_reverse($this->majorVersionRepository->findAll()->toArray()); $majorVersions = array_reverse($this->majorVersionRepository->findAll()->toArray());
$this->view->assign('majorVersions', $majorVersions); $this->view->assign('majorVersions', $majorVersions);
...@@ -75,14 +79,16 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -75,14 +79,16 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* *
* @param MajorVersion[] $majorVersions * @param MajorVersion[] $majorVersions
*/ */
protected function renderCharts($majorVersions) protected function renderCharts($majorVersions): void
{ {
$this->pageRenderer->addJsLibrary('amcharts', 'EXT:typo3_roadmap/Resources/Public/JavaScript/amcharts.min.js'); /** @var PageRenderer $pageRenderer */
$this->pageRenderer->addJsLibrary('amcharts_serial', 'EXT:typo3_roadmap/Resources/Public/JavaScript/serial.min.js'); $pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRenderer::class);
$this->pageRenderer->addJsLibrary('amcharts_gantt', 'EXT:typo3_roadmap/Resources/Public/JavaScript/gantt.min.js'); $pageRenderer->addJsFooterLibrary('amcharts', 'EXT:typo3_roadmap/Resources/Public/JavaScript/amcharts.min.js');
$this->pageRenderer->addJsLibrary('amcharts_lightheme', 'EXT:typo3_roadmap/Resources/Public/JavaScript/lighttheme.min.js'); $pageRenderer->addJsFooterLibrary('amcharts_serial', 'EXT:typo3_roadmap/Resources/Public/JavaScript/serial.min.js');
$this->pageRenderer->addJsLibrary('amcharts_export', 'EXT:typo3_roadmap/Resources/Public/JavaScript/export.min.js'); $pageRenderer->addJsFooterLibrary('amcharts_gantt', 'EXT:typo3_roadmap/Resources/Public/JavaScript/gantt.min.js');
$this->pageRenderer->addCssFile('EXT:typo3_roadmap/Resources/Public/Css/export.css'); $pageRenderer->addJsFooterLibrary('amcharts_lightheme', 'EXT:typo3_roadmap/Resources/Public/JavaScript/lighttheme.min.js');
$pageRenderer->addJsFooterLibrary('amcharts_export', 'EXT:typo3_roadmap/Resources/Public/JavaScript/export.min.js');
$pageRenderer->addCssFile('EXT:typo3_roadmap/Resources/Public/Css/export.css');
// @TODO comment css // @TODO comment css
$data = $this->generateChartArray($majorVersions); $data = $this->generateChartArray($majorVersions);
$this->view->assign('data', $data); $this->view->assign('data', $data);
...@@ -147,7 +153,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -147,7 +153,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
} }
}); });
'; ';
$this->pageRenderer->addJsFooterInlineCode('ltsChart', $chartJs); $pageRenderer->addJsFooterInlineCode('ltsChart', $chartJs);
} }
/** /**
...@@ -157,9 +163,11 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -157,9 +163,11 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* *
* @return bool|string * @return bool|string
*/ */
protected function dateFromTimestamp($timeStamp = 0) protected function dateFromTimestamp($timeStamp = 0): ?string
{ {
return date('Y-m-d', $timeStamp); $date = date('Y-m-d', $timeStamp);
return $date ?: null;
} }
/** /**
...@@ -170,7 +178,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll ...@@ -170,7 +178,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* *
* @return array * @return array
*/ */
protected function generateChartArray($majorVersions) protected function generateChartArray($majorVersions): array
{ {
$data = array(); $data = array();
foreach ($majorVersions as $index => $majorVersion) { foreach ($majorVersions as $index => $majorVersion) {
......
<?php <?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Domain\Model; namespace T3o\Typo3Roadmap\Domain\Model;
/** /**
...@@ -14,16 +15,19 @@ namespace T3o\Typo3Roadmap\Domain\Model; ...@@ -14,16 +15,19 @@ namespace T3o\Typo3Roadmap\Domain\Model;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/** /**
* Feature * Feature
*/ */
class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity class Feature extends AbstractEntity
{ {
/** /**
* header * header
* *
* @var string * @var string
* @validate NotEmpty * @Extbase\Validate("NotEmpty")
*/ */
protected $header = ''; protected $header = '';
...@@ -31,7 +35,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -31,7 +35,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* description * description
* *
* @var string * @var string
* @validate NotEmpty * @Extbase\Validate("NotEmpty")
*/ */
protected $description = ''; protected $description = '';
...@@ -39,7 +43,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -39,7 +43,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* images * images
* *
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/ */
protected $images = null; protected $images = null;
...@@ -54,7 +58,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -54,7 +58,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* typo3releaseminorversion * typo3releaseminorversion
* *
* @var \T3o\Typo3Roadmap\Domain\Model\MinorVersion * @var \T3o\Typo3Roadmap\Domain\Model\MinorVersion
* @lazy * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/ */
protected $typo3releaseminorversion = null; protected $typo3releaseminorversion = null;
...@@ -62,7 +66,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -62,7 +66,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* typo3releasemajorversion * typo3releasemajorversion
* *
* @var \T3o\Typo3Roadmap\Domain\Model\MajorVersion * @var \T3o\Typo3Roadmap\Domain\Model\MajorVersion
* @lazy * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/ */
protected $typo3releasemajorversion = null; protected $typo3releasemajorversion = null;
...@@ -70,16 +74,40 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -70,16 +74,40 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* featureArea * featureArea
* *
* @var \T3o\Typo3Roadmap\Domain\Model\FeatureArea * @var \T3o\Typo3Roadmap\Domain\Model\FeatureArea
* @lazy * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/ */
protected $featureArea = null; protected $featureArea = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects(): void
{
$this->images = new ObjectStorage();
$this->typo3releasemajorversion = new ObjectStorage();
$this->typo3releaseminorversion = new ObjectStorage();
}
/** /**
* Returns the header * Returns the header
* *
* @return string $header * @return string $header
*/ */
public function getHeader() public function getHeader(): string
{ {
return $this->header; return $this->header;
} }
...@@ -90,7 +118,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -90,7 +118,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $header * @param string $header
* @return void * @return void
*/ */
public function setHeader($header) public function setHeader(string $header): void
{ {
$this->header = $header; $this->header = $header;
} }
...@@ -100,7 +128,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -100,7 +128,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return string $description * @return string $description
*/ */
public function getDescription() public function getDescription(): string
{ {
return $this->description; return $this->description;
} }
...@@ -111,7 +139,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -111,7 +139,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $description * @param string $description
* @return void * @return void
*/ */
public function setDescription($description) public function setDescription(string $description): void
{ {
$this->description = $description; $this->description = $description;
} }
...@@ -121,7 +149,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -121,7 +149,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return string $link * @return string $link
*/ */
public function getLink() public function getLink(): string
{ {
return $this->link; return $this->link;
} }
...@@ -132,7 +160,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -132,7 +160,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $link * @param string $link
* @return void * @return void
*/ */
public function setLink($link) public function setLink(string $link): void
{ {
$this->link = $link; $this->link = $link;
} }
...@@ -142,7 +170,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -142,7 +170,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea * @return \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
*/ */
public function getFeatureArea() public function getFeatureArea(): FeatureArea
{ {
return $this->featureArea; return $this->featureArea;
} }
...@@ -153,7 +181,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -153,7 +181,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea * @param \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
* @return void * @return void
*/ */
public function setFeatureArea(\T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea) public function setFeatureArea(FeatureArea $featureArea)
{ {
$this->featureArea = $featureArea; $this->featureArea = $featureArea;
} }
...@@ -161,9 +189,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -161,9 +189,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* Returns the typo3releaseminorversion * Returns the typo3releaseminorversion
* *
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion * @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion
*/ */
public function getTypo3releaseminorversion() public function getTypo3releaseminorversion(): MinorVersion
{ {
return $this->typo3releaseminorversion; return $this->typo3releaseminorversion;
} }
...@@ -174,7 +202,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -174,7 +202,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion * @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion
* @return void * @return void
*/ */
public function setTypo3releaseminorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion) public function setTypo3releaseminorversion(MinorVersion $typo3releaseminorversion): void
{ {
$this->typo3releaseminorversion = $typo3releaseminorversion; $this->typo3releaseminorversion = $typo3releaseminorversion;
} }
...@@ -182,9 +210,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -182,9 +210,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* Returns the typo3releasemajorversion * Returns the typo3releasemajorversion
* *
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion * @return \T3o\Typo3Roadmap\Domain\Model\MajorVersion
*/ */
public function getTypo3releasemajorversion() public function getTypo3releasemajorversion(): MajorVersion
{ {
return $this->typo3releasemajorversion; return $this->typo3releasemajorversion;
} }
...@@ -192,42 +220,20 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -192,42 +220,20 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* Sets the typo3releasemajorversion * Sets the typo3releasemajorversion
* *
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion * @param \T3o\Typo3Roadmap\Domain\Model\MajorVersion $typo3releasemajorversion
* @return void * @return void
*/ */
public function setTypo3releasemajorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion) public function setTypo3releasemajorversion(MajorVersion $typo3releasemajorversion): void
{ {
$this->typo3releasemajorversion = $typo3releasemajorversion; $this->typo3releasemajorversion = $typo3releasemajorversion;
} }
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects()
{
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/** /**
* Returns the images * Returns the images
*