Commit f04e48ab authored by Thomas Löffler's avatar Thomas Löffler

Fix issue with missing ObjectStorage and add author name to liked list

parent 1ff1aaec
Pipeline #6410 passed with stages
in 5 minutes and 59 seconds
......@@ -23,6 +23,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function __construct()
{
parent::__construct();
$this->likedExtensions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
......@@ -31,6 +32,9 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function getLikedExtensions(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage
{
if ($this->likedExtensions === null) {
$this->likedExtensions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
return $this->likedExtensions;
}
......@@ -44,7 +48,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function addLikedExtension(Extension $extension)
{
if (!$this->likedExtensions->contains($extension)) {
if (!$this->getLikedExtensions()->contains($extension)) {
$extension->increaseLikes();
$this->likedExtensions->attach($extension);
}
......@@ -52,7 +56,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function removeLikedExtension(Extension $extension)
{
if ($this->likedExtensions->contains($extension)) {
if ($this->getLikedExtensions()->contains($extension)) {
$extension->decreaseLikes();
$this->likedExtensions->detach($extension);
}
......
......@@ -204,7 +204,8 @@
<f:for each="{likedExtensions}" as="extension">
<tr>
<td class="text-middle">
<f:link.action controller="Extension" action="show" arguments="{extension: extension}">{extension.extKey}</f:link.action>
<f:link.action controller="Extension" action="show" arguments="{extension: extension}">{extension.extKey}</f:link.action><br>
{extension.lastVersion.author.name}
</td>
<td>
<f:if condition="{extension.lastVersion.reviewState} != -1">
......
Markdown is supported
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